MacDownApp / MacDownApp/macdown
Commented headings are erroneously included in the [toc]
Nobody has claimed this yet.
- Dominant language
- Rich Text Format
- Stars
- 9.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
the parser erroneously includes hidden headings in the [toc], which causes the [toc] to contain the wrong headings (i.e. hidden headings).
Also the links in the [toc] refer to the wrong section (e.g. a link to #toc_2 is generated, but the generated markup only contains anchors up to #toc_1)
Input:
```markdown
[toc]
# Heading 1
This is some text
# Heading 2
This is some text
```
Expected output:
```html
Heading 1
This is some text
Heading 2
This is some text
```
Actual output:
```html
Heading 1
This is some text
Heading 2
This is some text
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in MacDown with the provided Markdown input, then trace the Markdown parser and [toc] generation entry point to see how commented headings are counted. Done means the commented heading is absent from the table of contents and the remaining links use matching anchors such as #toc_0 and #toc_1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown
- Domain
- content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100