derlin / bitdowntoc

Online and command-line Markdown TOC generator, with built-in support for BitBucket Server, GitHub, Gitlab, dev.to and more!
https://bitdowntoc.derlin.ch
Other
92 stars 8 forks source link

Missing TOC end causes parsing to fail #49

Closed maurymarkowitz closed 5 months ago

maurymarkowitz commented 5 months ago

I had a document that still had a <!-- TOC start but the matching <!-- TOC end was missing for some reason. In this case, Generate produces no output.

I believe this should report an error. Alternately, the next <!-- TOC --> might be used to indicate the end, in the same fashion as one <p> intrinsically closes another.

derlin commented 5 months ago

Thank you for reporting this issue.

This seems like a corrupted document. The same may happen if the markdown is malformed (e.g. missing end of code block). I am not sure I want to go into the rabbit hole of reporting every corruption.

In this instance, though, I agree that it would make sense to warn the user in case of a missing toc marker end. I will see what I can do.

maurymarkowitz commented 5 months ago

If it is straightforward, looking for a missing TOC start before a TOC end would likely be useful too.