CrossNox / m2r2

Markdown to reStructuredText converter
https://crossnox.github.io/m2r2
MIT License
107 stars 26 forks source link

Fix WARNING: duplicate label #59

Open ItsDrike opened 1 year ago

ItsDrike commented 1 year ago

When including a document that contains multiple headings with exactly the same names, such as a changelog like this:

# Version 1
## Bugfixes
- A
- B
- C

# Version 2
## Bugfixes
- A
- B
- C
## Features
- X
- Y

The h2 headings are duplicated, and so duplicate label warnings appear.

A potential solution to this could be to replicate what MyST is doing, and use placeholder ids like #id1, #id2, etc. for any such duplicate labels, to allow referencing any title easily, without any conflicts.

i.e. the final version shouldn't look like this: image

But rather like this: image

ReenigneArcher commented 10 months ago

+1, I'm also wanting to include changelog in my docs. Only solution I have found is to use

**Heading** instead of ## Heading, but it's not ideal.