Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Highlight changed text so it is clear what has been changed #44

Open
dzfranklin opened this issue Mar 15, 2016 · 1 comment
Open

Highlight changed text so it is clear what has been changed #44

dzfranklin opened this issue Mar 15, 2016 · 1 comment

Comments

@dzfranklin
Copy link

Showing the original on hover would be great.
For example with the injected css of

.xkcd-substitutions-substitution {
   background-color: yellow;
}

instead of directly replacing the text you could insert

<span class="xkcd-substitutions-substitution" title="${sanitize_attribute_val(origional_text)}">
    ${replacement_text}
</span>

where sanitize_attribute_val is something like

function sanitize_attribute_val(unsanitized){
    return unsanitized.replace(/([^A-z0-9])/g, function(symbol){
        return "&#" + symbol.charCodeAt() + ";"
    });

Would you accept a pull request?

@dzfranklin dzfranklin changed the title Highlight changed text so it is clear what has changed Highlight changed text so it is clear what has been changed Mar 15, 2016
@piquan
Copy link

piquan commented May 20, 2016

There's an open issue #27 for changing the font. I wrote an implementation for that in pull request #48 which works similarly to what you suggested, by putting replacements in a span with a class. That means you could use something like the Stylish extension to add your own CSS and attach it to that class. If Posnet accepts my pull request, would that do what you want?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants