mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Question: Sanitize Markdown #646
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @molinch on GitHub (Dec 28, 2023).
First of all thanks for the awesome lib!
Are you aware of a possibility to parse a string that contains Markdown and sanitize it to ensure only the allowed Markdown functionalities remain?
In our case we want to guarantee we want to guarantee we can only use bold/italic/lists/links.
@xoofx commented on GitHub (Dec 29, 2023):
Yes, it is possible. Markdig provides the full Abstract Syntax Tree (AST) of a parsed Markdown document. You can process this AST to remove any nodes that are not relevant for your case.
@molinch commented on GitHub (Dec 29, 2023):
Merci Alexandre. I'll go that way :)