nojronatron / markdown-toc

VSCode Extension adds table of contents to an existing markdown file.
https://marketplace.visualstudio.com/items?itemName=jon-rumsey-dev.jr-markdowntoc-vscode
MIT License
1 stars 0 forks source link

Generated TOC Does Not Space Self Wisely #39

Open nojronatron opened 1 month ago

nojronatron commented 1 month ago

Describe the bug

If the target markdown document has a newline linting error (meaning, there are non-bulleted sentences without a line-feed separating them) in the region where the new TOC is generated, the newline linting error will remain. This leaves a linting error where the generated TOC Header is placed.

Not a bug so much as a situation that the extension should be smart enough to handle without any negative side effects.

To Reproduce

  1. Create or open a markdown document that has a lint-passing structure with a single L1 header and at least one L2 header.
  2. Remove an LF between the L1 header (or its content) and the first L2 header.
  3. Open the Command Palette and select Create Table of Contents.
  4. See the lack of a LF between the L1 content and the L2 "Table of Contents" header.

Expected behavior

The extension will check to make sure there are two LFs before and following the generated Table of Contents is copies in.

Screenshots

None.

Environment

Additional context

None.