r/learnjavascript • u/BrotherManAndrew • 9d ago
Micromark how to parse " " as a non-whitespace
Hi, I am using the plugin
https://github.com/remarkjs/react-markdown Which is fully compliant with Micromark and I assume it uses it as a base, well moreso it uses Remark and rehype which I assume is built off micromark. Anyways
However when ever a " " is present, it is just rendered as a whitespace which I really don't want, how do I avoid this? Small question that's all
2
Upvotes
2
u/GiggleSamurai 9d ago
That's standard CommonMark: numeric character references like   are decoded to the character, so micromark is doing what the spec says. Escape the ampersand in the source (\  or  ) and it renders as the literal text; if the text comes from users, replace & with \& before passing it to react-markdown.