Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
[How] can I escape all markup characters in CommonMark source?
My Rationale
At github.com/mysociety/alaveteli/issues/8958, I needed to post the rendered text of an .eml into a form that utilised GitHub's "GitHub-Flavoured Markdown" superset of CommonMark.
CommonMark inherently includes HTML5 LS support, but GHFM lacks <xmp> support. [1] The sole available equivalent is <pre>, so to have such content render, I need to run it through an HTML5 sanitiser.
This isn't much of a problem, except that it also supports CommonMark. No quivalent exists for CM. Consequently, I am forced run it through an LLM for the subsequent CommonMark sanitisation step.
Nobody should ever require sanitisation by LLM...
Conducted Research
At stackoverflow.com/revisions/48151864/2, I see that a way to achieve this for HTML would be to utilise an InterNet browser as a parser. No equivalent exists for CommonMark. [2]
Consequently, does a library provide this in its stead, or must I literally hardcode every escape sequence, the next time I want to accomplish this?
The Placement Of The Question
Although the tag may state that software recommendations are, wholesale, off-topic, posts/288333/history#1 explains otherwise I am inclined to consider its sensible nuances to be authoritative.
Regardless, if code is able to achieve this, I shall consider that to be an answer; a pre-packaged “tool” (so-to-speak) isn't required (nor, per se, desired). However, a GUI is preferrable over a script, because its user experience is inherently so far improved.
If, regardless, undesirable here, please move to Power Users. [3]

0 comment threads