amyreese / markdown-pp

Preprocessor for Markdown files to generate a table of contents and other documentation needs
MIT License
309 stars 68 forks source link

Don't demote empty underlines in included files #68

Closed JohnathonNow closed 5 years ago

JohnathonNow commented 5 years ago

This attempts to fix #65.

It does so by ensuring that, before demoting a underlined header to the next smallest subheader, that the line above it contains some text.

It adds two checks:

  1. It checks that the current line is not the first of an included file
  2. It checks that the line above the underline has some characters that are neither whitespace nor a non-escaped formatting character

If these conditions pass then the underlined header is demoted.