Title with trailing spaces
Closed this issue · 1 comments
laowantong commented
Hello again! Just noticed that when the last character of a title is an (admittedly useless) space, the generated anchor is wrong (tested on GitHub).
import md_toc
open("test.md", "w").write("""
# title
## title with a trailing space
""")
print(md_toc.build_toc('test.md'))
Result:
- [title](#title)
- [title with a trailing space ](#title-with-a-trailing-space-)
May be a .strip()
somewhere would fix the issue?
frnmst commented
HI,
I don't know / remember if this is a bug or not. At the moment md_toc uses the previous version of CommonMark spec (0.28
instead of 0.29
). Maybe something changed. Have a look at:
- https://spec.commonmark.org/0.29/changes.html
- https://frnmst.github.io/md-toc/markdown_specification.html#rules
- #14
If you find a solution, by all means open a pull request: