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

Include directive breaks footnote references #1024

Open
b-kamphorst opened this issue Feb 13, 2025 · 0 comments
Open

Include directive breaks footnote references #1024

b-kamphorst opened this issue Feb 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@b-kamphorst
Copy link

b-kamphorst commented Feb 13, 2025

What version of myst-parser are you using?

4.0.0

What version dependencies are you using?

Python==3.12.8
docutils==0.21.2
sphinx==8.1.3

Operating system: WSL2 on Windows, Ubuntu distribution.

What operating system are you using?

Linux

Describe the Bug

When parsing a markdown document with footnotes, this parses into a fine HTML. However, if that markdown is included in a .rst file, then the footnotes break. In particular, the references to the footnotes are parsed into <a href="#id1"><span class="problematic" id="id1"> and the footnotes themself get a new id.

See below the rendered output of ./index.html:

Image

It is not clear to me whether this is a bug on MyST's or Sphinx's side.

Expected Behavior

I would expect the footnotes in the HTML that includes Markdown to work properly.

See below the rendered output of ./test.html:

Image

To Reproduce

conf.py

extensions = [
    "myst_parser",
]

index.rst

.. include:: test.md
   :parser: myst_parser.sphinx_

test.md

# Example

Following the footnote example follows [the example in the v4.0.1 documentation](https://myst-parser.readthedocs.io/en/v4.0.1/syntax/typography.html#footnotes), although the manually-numbered footnote is auto-numbered.

- This is a manually-numbered footnote reference.[^a]
- This is an auto-numbered footnote reference.[^myref]

[^myref]: This is an auto-numbered footnote definition.
[^a]: This is a manually-numbered footnote definition.

Then just run sphinx-build . public. The output will show

test.md:5: ERROR: Unknown target name: "a". [docutils]
test.md:6: ERROR: Unknown target name: "myref". [docutils]

Note: the actual example in the documentation has a manually-numbered footnote ^3, but this also introduces an error. This is described in #1025.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant