Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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?

+0
−1

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]


  1. stackoverflow.com/revisions/11249786/2 ↩︎

  2. stackoverflow.com/revisions/79805092/1 ↩︎

  3. meta.codidact.com/posts/279821/history#1 ↩︎

History

0 comment threads

Sign up to answer this question »