mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Using a subset of the markdown syntax #133
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 @xt0rted on GitHub (Aug 20, 2017).
I want to use a subset of the markdown syntax (bold, italic, underline, strike, lists, paragraphs) and would like the rest of the syntax to render as plain text (
# Textwould render as-is instead of<h1>Text</h1>). Is there a way to adjust the settings so I can achieve this type of setup?@xoofx commented on GitHub (Aug 21, 2017):
You should be able to remove the relevant parsers from the
MarkdownPipelineBuilder(by modifying the registered parsers inInlineParsersandBlockParsersthrough the builder)c761fa2243/src/Markdig/MarkdownPipelineBuilder.cs (L27-L49)You might run into some trouble to disable some constructions that are hardcoded in some parsers (like the settext heading in the
ParagraphBlockParser) as they would require a few changes in the code to make it possible. But nothing impossible...@xt0rted commented on GitHub (May 7, 2018):
@xoofx I finally got around to playing with this and was wondering if what I'm seeing is expected behavior since you said some things are hardcoded.
My parsers are setup like so:
If my markdown is
---,___, or***then it's rendered as<hr />even though theThematicBreakParserisn't included. If I comment out theListBlockParserthen these aren't converted to html. Is this correct? Why would theListBlockParserbe creating<hr />elements when there's a parser for this which isn't even setup?@xoofx commented on GitHub (May 7, 2018):
Han, unfortunately, you are hitting a workaround in the code... that would require a bit modification to work. Currently, the
ListBlockParseris accessing a singletonThematicBreakParser.Defaultwhile it should instead query for the ThematicBreakParser in its initialize method, and use it if it is present. It is not a big change, so PR welcome.@xt0rted commented on GitHub (May 18, 2018):
I'll be taking a look at this in the coming weeks hopefully.