Allow more leading # in ATX heading as a customization option #255

Closed
opened 2026-01-29 14:31:50 +00:00 by claunia · 3 comments
Owner

Originally created by @yufeih on GitHub (Jan 7, 2019).

We are using TOC.md to represent table of contents, It is a restricted markdown format that only allows several known markdown syntax, like links and ATX headers.

Sometimes these files can be very big and exceed maximum leading count as defined by common mark spec, like this one,

The ask is if it is possible to have an option in HeadingBlockParser that can override the default max leading count (6), so we can reuse HeadingBlockParser to parse our special TOC markdown.

Related https://github.com/dotnet/docfx/issues/3874

Originally created by @yufeih on GitHub (Jan 7, 2019). We are using `TOC.md` to represent table of contents, It is a restricted markdown format that only allows several known markdown syntax, like links and ATX headers. Sometimes these files can be very big and exceed [maximum leading count](https://github.com/lunet-io/markdig/blob/master/src/Markdig/Parsers/HeadingBlockParser.cs#L54) as defined by common mark spec, like [this one](https://raw.githubusercontent.com/MicrosoftDocs/VBA-Docs/master/api/TOC.md), The ask is if it is possible to have an option in `HeadingBlockParser` that can override the default max leading count (6), so we can reuse `HeadingBlockParser` to parse our special TOC markdown. Related https://github.com/dotnet/docfx/issues/3874
claunia added the enhancementPR Welcome! labels 2026-01-29 14:31:50 +00:00
Author
Owner

@xoofx commented on GitHub (Jan 7, 2019):

Sure, via an extension and a slight change on HeadingBlockParser, PR welcome

@xoofx commented on GitHub (Jan 7, 2019): Sure, via an extension and a slight change on `HeadingBlockParser`, PR welcome
Author
Owner

@OsmondJiang commented on GitHub (Jan 8, 2019):

Thanks a lot for quickly merging the PR 👍, it would be great if we can know when we can get a new nuget version?

@OsmondJiang commented on GitHub (Jan 8, 2019): Thanks a lot for quickly merging the PR 👍, it would be great if we can know when we can get a new nuget version?
Author
Owner

@xoofx commented on GitHub (Jan 11, 2019):

It should be come with upcoming 0.15.7 in a few minutes

@xoofx commented on GitHub (Jan 11, 2019): It should be come with upcoming `0.15.7` in a few minutes
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#255