Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate header names are not differentiated in IDs #225

Closed
camoz opened this issue Jul 4, 2020 · 6 comments
Closed

Duplicate header names are not differentiated in IDs #225

camoz opened this issue Jul 4, 2020 · 6 comments
Assignees

Comments

@camoz
Copy link

camoz commented Jul 4, 2020

Shamelessly copied from markedjs/marked#879:

Other markdown parsers support having multiple sections with the same name, but this one doesn't.

Input:

# test
# test

Expected Output:

<h1 id="test">test</h1>
<h1 id="test-1">test</h1>

Actual Output:

<h1 id="test">test</h1>
<h1 id="test">test</h1>

Supporting this means subsections can go by the same name. (for instance, in an md file I have, I have a section for specifications of files, and another section for examples of the files in action, and each section needs a subsection of the same name, as they're the same file)
There are probably other use cases as well. Also supporting this would make it not be invalid html =P

@Orc Orc self-assigned this Jul 10, 2020
@Orc
Copy link
Owner

Orc commented Mar 23, 2022

Ok, after a considerable delay thanks to the plague, I've implemented unique labels for tables of content. If you're still waiting on this, can you check it out (and sorry for the delay)

@camoz
Copy link
Author

camoz commented Mar 28, 2022

Works great for me, thank you!

On a different note, I noticed that markdown -f +toc,+style ... does not work, I need to do markdown -toc -style .... Maybe I'm reading the man page wrong, but from what I understand it says you should do markdown -f +toc,+style .... Any idea?

@camoz camoz closed this as completed Mar 28, 2022
@Orc
Copy link
Owner

Orc commented Mar 28, 2022

That's because I didn't do it properly! If there are multiple sections (style + text + ???) on the top level, it will only uniquify the style section which is NOT what I intended!

@Orc Orc reopened this Mar 28, 2022
@camoz
Copy link
Author

camoz commented Apr 4, 2022

Not sure I follow, what I meant was how the translation flags are specified. A more simple example: According to the man page, markdown -f +toc ... should include a ToC, but for me it doesn't - I need to do markdown -toc .... The man page describes a different syntax.

@Orc
Copy link
Owner

Orc commented Apr 4, 2022

Ah. The -toc flag is a shortcut for -T -f+toc (to both enable TOC processing and to output a TOC); if you just to -f +toc by itself, the markdown program will make the TOC but won't show it to you.

@camoz
Copy link
Author

camoz commented Apr 4, 2022

I see. Thank you!

@Orc Orc closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants