Dear craftzdog and others,
I am currently working on a plugin to support text highlighting in Inkdrop. My starting point was a similar plugin for remark
that parses ||foo||
and transforms it into <kbd>foo</kbd>
. That is lesser known HTML tag that denotes keyboard input elements.
At first it seemed that I could use this as a template for my plugin. Moreover remark-kbd
works seemlessly with Inkdrop. When I tried to replace <kbd>
with <mark>
I ran into a problem, because somewhere during the parsing process the HTML tag got sanitized and was missing from the output. I am sure it must have been sanitized, because the syntax elements !!
got consumed indicating that the parser in fact added a new node to the mdast
syntax tree.
I suspect that Inkdrop uses the hast-util-sanitize
plugin for sanitization, maybe implicitly as part of mdast-util-to-hast
. The default ruleset includes a whitelist of tagNames where kbd
is included, but mark
is not (and neither is span
for that matter). This prevents me from using meaningful HTML tags for text highlighting. My workaround at the moment is to use <strong>
along with a custom CSS class as a discriminator for highlighted text, but that solution is not optimal.
Maybe you can look into it and change the ruleset used during Markdown processing to allow for <mark>
tags.
Thank you!