Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.
This repository was archived by the owner on May 27, 2021. It is now read-only.

Code snippet of same name directly following heading interferes with TOC: insert/update #69

@miller-productions

Description

@miller-productions

Hi Alan,

Thanks for creating markdown-toc, I enjoy using it.

I recently discovered a really bizarre edge case bug that you might be interested in.


Summary

If you have a heading line which is directly followed by a <code-snippet-with-angle-brackets> and the code snippet has the same text as the heading, the TOC generated by TOC: insert/update gets cut off.

Below is an example. See how the generated TOC doesn't go further than Heading3...

------- BEGIN EXAMPLE ----------

<!-- TOC -->

- [Heading1](#heading1)
- [Heading2](#heading2)
- [Heading3](#heading3)

<!-- /TOC -->

## Heading1 ##

Some text

## Heading2 #

Some more text, with a ```<heading2>``` code snippet

## Heading3 ###

```<heading3>``` code snippet is the first entry after the heading, and has the same name

Suspect that this code snippet is the culprit

## Other Heading ##

Expect to see this other heading in the TOC

## Also Expected ##

Will this turn up in TOC?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions