Reputation: 470
Is it possible in any way to insert a link to a Markdown file that points to an anchor in a reStructuredText file?
I have a project documentation that contains .rst and .md files as well, and I'm using the m2rr Sphinx extension, however it only seems to support in-file rst anchor links.
Is there any way to achieve this?
Upvotes: 3
Views: 2233
Reputation: 15045
Markdown itself does not support cross-referencing to arbitrary locations across documents.
One workaround is to insert an HTML based anchor.
[My Label](/root-relative-url.html#anchor-in-page)
Another option is to use MyST. Here you would instead of using markdown for the anchor, you would use either MyST syntax or embed reST syntax.
Target headers are defined with this syntax:
(header_target)=
They can then be referred to with the ref inline role:
{ref}`header_target`
By default, the reference will use the text of the target (such as the section title), but also you can directly specify the text:
{ref}`my text <header_target>`
Upvotes: 7