mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-12 05:44:48 +00:00
Question about efficient blocks extraction #224
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 @JustArchi on GitHub (Sep 21, 2018).
Hello. First of all thank you a lot for your time put into this awesome library, I'm loving it so far.
In my current use case I'm trying to extract a changelog from a markdown text. In particular I need this section in markdown so I can render it as HTML and plain text afterwards. Source markdown has simple structure:
I've successfully written a function capable of extracting changelog from the document above as:
While this solution is perfect for me and it works properly, I'm wondering if it's a proper way to achieve what I want, and if there is no better way to go about this in terms of code or performance. I've tried hard to find out any traces of easier blocks extraction but I didn't find any method that would work for me.
Could you please take a look at above C# code and tell me if it's correct usage of your library for what I want to achieve? Perhaps you'd want to suggest some fixes or entirely different approach. Thank you a lot!
@xoofx commented on GitHub (Sep 26, 2018):
Your approach is perfectly fine. But depending on your the amount of blocks to remove, it might be better to remove changelog blocks from the document you are processing and move them to a new
MarkdownDocumentobject. It will create less remove/changes on the original markdown document.