Closed cpadilla closed 2 years ago
I ran across the issue of headers generating the same links if they have the same name.
Based on the way markdown generates heard links (based on this documentation I found):
The IDs are generated from the content of the header according to the following rules: All text is converted to lowercase. All non-word text (e.g., punctuation, HTML) is removed. All spaces are converted to hyphens. Two or more hyphens in a row are converted to one. If a header with the same ID has already been generated, a unique incrementing number is appended, starting at 1.
The IDs are generated from the content of the header according to the following rules:
Seems to be accurate. Judging by the default slugify, it seems like only rules 1 and 3 are being used, but I haven't tested this.
slugify
I added logic to cover rule 5, although it appears to be the case that the number appended actually starts at 2.
I might additional test cases for duplicate header names if I have time tomorrow.
Finished committing changes. Fixed test file names from #51. Added test files and a new test for duplicate headings.
@cpadilla Any plans to merge this? I'm running into the same issue
I ran across the issue of headers generating the same links if they have the same name.
Based on the way markdown generates heard links (based on this documentation I found):
Seems to be accurate. Judging by the default
slugify
, it seems like only rules 1 and 3 are being used, but I haven't tested this.I added logic to cover rule 5, although it appears to be the case that the number appended actually starts at 2.
I might additional test cases for duplicate header names if I have time tomorrow.