highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

add (markdown) emphasis escaping

Open Crater44 opened this issue 1 year ago • 4 comments

This feature adds the possibility of escaping italic on markdown

Before the only way to write a word with underscore (e.g. SYS_ADMIN) was placing a space after the underscore, now it's possible to escape it with a backslash so it won't trigger the italic feature.

Change

The change consist on combining the actual negative look-ahead for a space with a negative look-behind for a backslash

Crater44 avatar Oct 15 '23 08:10 Crater44

Sadly, we cannot use negative look behind yet as that feature is still too newly added to Safari.

joshgoebel avatar Oct 15 '23 18:10 joshgoebel

Actually, hold that thought, perhaps it's time to change this policy: https://github.com/highlightjs/highlight.js/issues/3890

joshgoebel avatar Oct 15 '23 18:10 joshgoebel

@joshgoebel great so if my change can be added that would be great to me because I have it patched in one of my projects and is not the best way to have it

Crater44 avatar Nov 03 '23 17:11 Crater44

No lookbehind for now as it would be a breaking change... why not just have a single (separate) rule that matches \* but then chooses not to highlight it? Would that hurt anything else?

joshgoebel avatar Nov 04 '23 02:11 joshgoebel