derlin / bitdowntoc

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

Angle brackets in TOC entries causes... something #48

Closed maurymarkowitz closed 1 week ago

maurymarkowitz commented 2 months ago

Some of my TOC entries have angle brackets, like:

### IF (*exp*) *lineno*{<cr>|;|[,*lineno*][{<cr>|;|,*lineno*]}}

When the TOC generation is run, the resulting anchors are "broken" and do not display properly.

I believe escaping these two characters during parsing would fix the issue.

derlin commented 2 months ago

Hello there, and thanks for reporting the issue! Which profile are you using? Can you confirm all those characters are "regular" text (those are not markers for some another processing tool)?

maurymarkowitz commented 2 months ago

If I'm parsing the question correctly, I am using "Generic".

Those characters are regular text. You can see the source here (although I removed the bits in question so I could post a working TOC, so look a previous check-in):

https://github.com/maurymarkowitz/RetroFOCAL/blob/main/doc/RetroFOCAL%20reference%20manual.md

I inserted backslashes by hand and that does fix the problem.

derlin commented 2 months ago

I have a hard time reproducing the issue. May I ask you for some more clarifications?

ONE Taking bot the old and new versions of the problematic anchor, I end up with exactly the same anchor generated:

<!-- TOC start (generated with https://github.com/derlin/bitdowntoc) -->

- [IF (*exp*) *lineno*{<cr>|;|[,*lineno*][{<cr>|;|,*lineno*]}}](#if-exp-linenolinenolineno)
- [`IF` (*exp*) *lineno*{;|[,*lineno*][{;|,*lineno*]}}](#if-exp-linenolinenolineno-1)

<!-- TOC end -->

<!-- TOC --><a name="if-exp-linenolinenolineno"></a>
### IF (*exp*) *lineno*{<cr>|;|[,*lineno*][{<cr>|;|,*lineno*]}}
<!-- TOC --><a name="if-exp-linenolinenolineno-1"></a>
### `IF` (*exp*) *lineno*{;|[,*lineno*][{;|,*lineno*]}}

We can see the result is the same, as the second anchor has a -1 at the end. Can you provide me with a reproducible example of the issue? Was it really this line that posed problem?

TWO I see you are publishing your markdown on Github, any reason not to use the Github profile? (It may be broken as well, just wondering).

THREE the current version of your markdown seems outdated. Did you rerun bitdowntoc after changing the content? I see lots of diff when copying your current version to bitdowntoc (missing anchors, old titles, etc.) and broken links. Bitdowntoc is idempotent, but needs to be reran every time headers change in your TOC.

Thank you for your help!

derlin commented 1 month ago

@maurymarkowitz any news?

derlin commented 1 week ago

Closing due to inactivity.