Hacker News new | ask | show | jobs
by Vinnl 1483 days ago
Yeah I'd like to have that too. Don't know yet how I'd implement it, but logged here and happy to take Merge Requests: https://gitlab.com/vincenttunru/obfuscate/-/issues/3
1 comments

Probably by

- locate the text node containing the selected text

- split the text node into 3 segment (the selected one in the middle)

- replace the selected segment with a span that has font style on it

?

I did something like this before to replace part of the text with a ruby tag.

https://codepen.io/mmis1000/pen/gOgKqba?editors=0010

Or probably you can do it the reverse the obfuscate the selected text and make it actually works like a black pen.

Although it will be definitely more complex because selection may cross multi text nodes. But the idea should apply.

Yeah, I was initially thinking block-level elements, but just selected text should be easier.