Make sure all anchors are created for RST links by felixfontein · Pull Request #1536 · github/markup · GitHub
Skip to content

Make sure all anchors are created for RST links - #1536

Merged
jmeridth merged 2 commits into
github:masterfrom
felixfontein:fix-rst-links
Sep 4, 2024
Merged

jmeridth merged 2 commits into
github:masterfrom
felixfontein:fix-rst-links

Conversation

@felixfontein

Copy link
Copy Markdown
Contributor

Fixes #1535.

Running the script on the source of https://gist.github.com/felixfontein/5ec5ad555ba6cdb293beb04c83280c90 produces:

<a name="test-section"></a>
<h2>Test section</h2>
<p>Link: <a class="reference internal" href="#target">link to target</a>.</p>
<a name="target-section"></a>
<a name="target"></a>
<h2>Target section</h2>
<p>The link should point to this section's title.</p>

Here both expected anchors (the auto-generated one from the section title, and the one from the label) are created.

On my system rest2html generates quite some different markup
so I'm not sure whether this actually works.
@felixfontein

Copy link
Copy Markdown
Contributor Author

@github-actions

github-actions Bot commented Sep 4, 2024

Copy link
Copy Markdown

@jmeridth jmeridth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixfontein I tested your change locally. Thank you for the contribution. It is greatly appreciated.

@jmeridth
jmeridth merged commit 914839f into github:master Sep 4, 2024
@felixfontein
felixfontein deleted the fix-rst-links branch September 5, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reStructured Text links to labels in same document do not work

2 participants