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

Mismatch Between Markdown Link Text and HTML id Attributes #387

Open
kennelvy opened this issue Nov 14, 2024 · 0 comments
Open

Mismatch Between Markdown Link Text and HTML id Attributes #387

kennelvy opened this issue Nov 14, 2024 · 0 comments

Comments

@kennelvy
Copy link

kennelvy commented Nov 14, 2024

When creating a link in Markdown, if the link text contains underscores, the resulting HTML link may not work correctly. This is because the id of the target element in HTML may not include underscores, and the href in the link must match the id exactly.

Consider the following example in Markdown:

Link
[TITLE](<#title>)
[A_TITLE](<#a_title>)
[THIS_TITLE](<#this_title>)
[OTHER_TITLE](<#other_title>)

In the generated HTML:

<h4 id="title">TITLE</h4>
<h4 id="atitle">A_TITLE</h4>
<h4 id="thistitle">THIS_TITLE</h4>
<h4 id="othertitle">OTHER_TITLE</h4>

the id attributes of the headings do not contain underscores. As a result, Markdown links with underscores in the href, such as [A_TITLE](<#a_title>), won’t work because the id in HTML is written without underscores (e.g., id="atitle").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant