Heading levels
Description
Please, add ability to control allowed heading levels such as CKEditor do
Example
It can be via config, similar to heading_permalink:
'heading_permalink' => [
'min_heading_level' => 1,
'max_heading_level' => 6,
],
To:
'headings' => [
'min_level' => 2,
'max_level' => 4,
],
So # H1 will became ## H2 & ###### H6 became #### H4 (closest allowed one)
Did this project help you today? Did it make you happy in any way?
Definitely love it ❤️
bump
Would this mean that e.g. with min_level=2 a heading with one asterisk # Head would be rendered as <h2>?
A use case that I often have is that a document with headings needs to be rendered both standalone (where it's headings would be as written) and also as subsections (where the headings would all be dropped down a level). Is that the sort of thing that this would accomplish?
This suggestion makes sense to me.
I'd recommend we create a separate extension for it, perhaps called LimitHeadingsExtension or something similar. That extension could observe the DocumentParsedEvent and run some code to adjust the heading levels throughout the parsed AST.
Anyone interested in contributing this? 😉