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

linked markdown documents are not linked in html output ... or not even found #658

Closed
TinkerSteve opened this issue Dec 16, 2022 · 3 comments
Labels
upstream This issue requires an upstream dependency fix

Comments

@TinkerSteve
Copy link

TinkerSteve commented Dec 16, 2022

Describe the bug

context
include a markdown document which is outside the sphinx root tree an which links to another markdown document in the same folder.

I am using the method described here:

https://myst-parser.readthedocs.io/en/latest/faq/index.html

this is my directory structure:

|-- level2
|   |-- img
|   |   `-- Clipboard02.png
|   |-- level21.md
|   `-- level22.md
`-- root
    |-- conf.py
    |-- index.rst
    |-- level1.md
    `-- level1_wrapper.rst

this is the content of the files:

index.rst:

test_toc
========

.. toctree::
  :hidden:

  level1_wrapper

level1_wrapper.rst

.. include:: level1.md
  :parser: myst_parser.sphinx_

level21.md:

# level2

here we include an image

![image](./img/Clipboard02.png)


here we try to link to another file, which fails

[level22](level22.md)

level22.md:

# level2

here we include an image

![image](./img/Clipboard02.png)


here we try to link to another file, which fails

[level22](level22.md)

expectation
I would expect level22.md be correctly linked after building the doc

bug
But instead I receive the following errors on the console:

preparing documents... done
writing output... [100%] level1_wrapper                                                                                                                                                            
/home/builder/myst_test/level2/level21.md:11: WARNING: 'myst' reference target not found: level22.md
/home/builder/myst_test/level2/level21.md:11: WARNING: 'myst' reference target not found: level22.md
generating indices... genindex done
writing additional pages... search done
copying images... [100%] ../level2/img/Clipboard02.png    

and links to the file do not get resolved in final document ... actually the file is not even getting converted

image

problem
This is a problem for people building distributed projects because they cannot build integrated docs out of it.

Reproduce the bug

  1. extract the attached archive

  2. run

    cd myst_test
    python -m venv .venv
    source .venv/bin/activate
    sphinx-build root docs
    
  3. look at the result

myst_test.zip

List your environment

python --version
Python 3.9.15
uname -a
Linux ISCN5CG2375QXY 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 GNU/Linux

alabaster==0.7.12
Babel==2.11.0
certifi==2022.12.7
charset-normalizer==2.1.1
docutils==0.19
idna==3.4
imagesize==1.4.1
importlib-metadata==5.1.0
Jinja2==3.1.2
Markdown==3.4.1
markdown-it-py==2.1.0
MarkupSafe==2.1.1
mdit-py-plugins==0.3.3
mdurl==0.1.2
myst-parser==0.18.1
packaging==22.0
Pygments==2.13.0
pytz==2022.6
PyYAML==6.0
requests==2.28.1
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
typing_extensions==4.4.0
urllib3==1.26.13
zipp==3.11.0



@TinkerSteve TinkerSteve added the bug Something isn't working label Dec 16, 2022
@welcome
Copy link

welcome bot commented Dec 16, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

abyesilyurt added a commit to abyesilyurt/pypdf that referenced this issue Jan 7, 2023
Internal markdown links in docs does not work due to a bug in myst-parser.
executablebooks/MyST-Parser#658

We can use an older version of myst-parser until the bug is fixed.
abyesilyurt added a commit to abyesilyurt/pypdf that referenced this issue Jan 7, 2023
Internal markdown links in docs does not work due to a bug in myst-parser.
executablebooks/MyST-Parser#658

We can use an older version of myst-parser until the bug is fixed.
MartinThoma pushed a commit to py-pdf/pypdf that referenced this issue Jan 7, 2023
Internal markdown links in docs do not work due to a bug in myst-parser.
executablebooks/MyST-Parser#658

We'll use an older version of myst-parser until the bug is fixed.

DOC: Add abyesilyurt as a contributor
@chrisjsewell
Copy link
Member

Heya,
This is the formal behaviour of sphinx: sphinx-doc/sphinx#6805 (comment)

include directive considers the file is a part of the current document

It's an upstream issue, that is not something that myst-parser can change

@chrisjsewell
Copy link
Member

As mentioned in https://myst-parser.readthedocs.io/en/latest/faq/index.html#include-a-file-from-outside-the-docs-folder-like-readme-md

For including Markdown files ONLY within other Markdown files, then there are the relative-doc, relative-img options,
but for including from an rst file, thats reliant on sphinx

@chrisjsewell chrisjsewell added upstream This issue requires an upstream dependency fix and removed bug Something isn't working labels Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream This issue requires an upstream dependency fix
Projects
None yet
Development

No branches or pull requests

2 participants