Highlightr-Plugin
Highlightr-Plugin copied to clipboard
Highlightr adds additional space after </mark>
Hi, thanks for the plugin!
One small issue I've noticed is that whenever I highlight text it adds an additional space after the closing mark tag. I don't mean the padding some of the styles have, but an actual literal space. I think this would be an error?
The same issue, but not sure if it is a deliberate design or a bug.
My workaround is to replace all the </mark>
with </mark>
before finishing editing a MD file, but this works well for Asian languages which do not use a space to separate words. As for English or other similar languages, you have to use RegEx to make a more accurate replacement.
I assumed it was a feature to allow you to keep typing
As it happens even when highlighting text in the middle of a paragraph you've already written it kind of just introduces a lot of spaces you have to be careful to edit out.
this is true, it would be better not to do this.
It would be a typo or bug. Go into the highlightr-plugin folder and open main.js. Search for selectedText && sufFirst
and replace the following:
(selectedText && sufFirst === " ") ||
(!selectedText && sufFirst === " ")
? editor.replaceSelection(`${prefix}${selectedText}${suffix}`)
: selectedText && sufFirst !== " "
? editor.replaceSelection(`${prefix}${selectedText}${suffix} `)
: editor.replaceSelection(`${prefix}${selectedText}${suffix} `);
with
(selectedText && sufFirst === " ") ||
(!selectedText && sufFirst === " ")
? editor.replaceSelection(`${prefix}${selectedText}${suffix}`)
: selectedText && sufFirst !== " "
? editor.replaceSelection(`${prefix}${selectedText}${suffix}`)
: editor.replaceSelection(`${prefix}${selectedText}${suffix} `);