mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-08 05:44:58 +00:00
Preferred way to implement extensions? (parser vs renderer manipulation) #360
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 @mlaily on GitHub (Apr 19, 2020).
First question:
What are the pros and cons of implementing extensions by manipulating the parser vs manipulating the renderer to obtain the same result? How to choose?
I have a specific case in mind: the
SoftlineBreakAsHardlineExtension.It's currently implemented by changing the parsing logic (using
LineBreakInlineParser.EnableSoftAsHard), but it could also have been implemented by changing the renderer logic (usingLineBreakInlineRenderer.RenderAsHardlineBreak)Second question, that triggered the first one:
SoftlineBreakAsHardlineExtensiondoes not cancel the parsing of hard line break constructs (double space or backslash at the end of a line). It's strange to see a backslash disappear for nothing when this extension is enabled...Would a PR be welcome to add an option doing that? (and if so, should it be done in the parsers logic, or the renderers logic? and should it be on by default for this extension?)
Thanks for your time.