mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Feature wishlist #314
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 @generateui on GitHub (Aug 4, 2019).
Hi all! I'm developing a library where standardized extensions can be written. The idea is to enable easy development of block and inline elements, which themselves have an internal syntax. I have built a layer on top of Markdig. In developing this library (which I will make available once I'm satisfied and licensing issues are fixed), I stumbled upon some things that I'd like to mention/discuss. These are:
Details:
While having a mutable AST is nice for performance, an immutable one is beneficial in preventing mistakes and gaining larger-sclae performance (multi-threading, async, reusability of AST parts)
This one is nice for testing and nice for "AST renderers". Some of my extensions don't render html but render markdown instead. This way normalized markdown rendering still works, and target html can reuse styling of the overall document stylesheet. In order to implement AST renderers, it's nice to provide a direct AST instead of a markdown string which is then parsed. It's faster, less error-prone and also typed.
I want to express my gratitude for publishing Markdig. This post is meant to take the existing solution and ponder about ways to move it forward.
@generateui commented on GitHub (Aug 4, 2019):
Oh, I don't want to keep it with words: I'm willing to invest time in implementing it.
@xoofx commented on GitHub (Aug 5, 2019):
Hi
Thanks for sharing your ideas. PR welcome within the following considerations:
For 1., I'm not very inclined for these kind of changes for Markdig. C# is so poorly equipped to provide immutable out of the box without having to fallback to a laborious design (like Roslyn) where you keep an internal tree mutable vs a public tree immutable. It will just kill the performance of Markdig, double allocations, making extensions and plugins also reallocate stuffs around... so I would prefer that we don't bring that.
For 2. sure, but no SyntaxFactory. I believe that a few constructors could be added... if we can leverage as much as possible on list initializers as well.
For 3. why not, assuming that we keep existing extensions working as it is. No dependencies to an external DI system.
Func<>could be enough.For 4. not sure we need something like that for now. We could have formalized process on MarkdownDocument at the end, but it would process the AST inline.
For 5. Markdig have been staying away from that, but maybe an extension providing this out-of-the-box could be possible, you can try.
@generateui commented on GitHub (Aug 10, 2019):
It currently looks like the lib I'm developing is a "higher-level thing". It simply uses Markdig as a library and building on top of it, and I'm not sure if the extensions to the Markdig core I'm building should be part of Markdig.