mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-08 21:37:02 +00:00
Extension - Header sections #296
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 @LukeTOBrien on GitHub (May 25, 2019).
Hello there,
I am currently working on a project using Markdown-it and I am looking to move to .NET and Markdig.
One of the plugins I am using is Markdown-it-header-sections - I think that would be a neat little extension for Markdig.
For the time being I will try and do the same sort of thing with processing the output.
Whatya think?
Luke
@MihaZupan commented on GitHub (May 25, 2019):
I think this should be achievable by a single post-processing sweep over the syntax tree, keeping a
Stack<heading level>along the way.There's no need to even touch the more complicated parsing logic.
@MihaZupan commented on GitHub (May 26, 2019):
At least for the simple case of section tags without any attributes and such, this is sufficient.
@LukeTOBrien commented on GitHub (May 26, 2019):
Thanks!
I never expected you to write this for me... Saves me having to do the job.
Perhaps this code snippet could be included in any future documentation encase anyone else has the need to do this?
I have created a Unit Test and here is the output I am getting:
For my purposes I only need two levels, so this test proves it works for me.