What should I be looking for, when I see '$stderr.puts "Incorrect section nesting: Need to start with 1"'
SpencerDawkins opened this issue · 5 comments
I made a decent number of changes to my markdown file, and am now seeing (for the first time in my life)
$stderr.puts "Incorrect section nesting: Need to start with 1"
I diffed my old and new markdown files, and don't see anything obvious, and part of my problem is almost certainly that I don't know how I can screw up "section nesting" in markdown.
Could you give me a clue?
Obviously this must have happened at least once in previous history, because the code checks for it now. What caused the problem last time? 🙃
kramdown-rfc needs to construct nested sections from what is essentially a flat input structure.
It looks for headings and generates a nested section start for each increase of the heading level.
This increase needs to be by 1 or we don't have a section title to give to the new nesting level.
So if your introduction starts with ##
or you maybe have a ###
heading inside a #
heading, kramdown-rfc will reduce the heading level so there is only a by 1 increase and you get the warning.
Of course, decreasing the level is possible by any amount as sections can be closed without a needing a title.
I plan to improve the error message in the next release.
@cabo - thank you for this. If I'd had a line number pointing to "###", that would have helped me a lot!