[英]Prevent MyST from changing .md image paths
I'm generating sphinx documentation with.md files that reference images via relative paths:我正在使用通过相对路径引用图像的 .md 文件生成 sphinx 文档:
.[](../_static/figures/image.png)
I use MyST to parse the.md files into html, but it removes the ../'
making all paths:我使用 MyST 将 .md 文件解析为 html,但它删除了../'
制作所有路径:
_static/figures/image.png
. _static/figures/image.png
。
The relative paths work fine before documentation generation and has to kept the same.相对路径在文档生成之前工作正常并且必须保持不变。 In the conf.py
for sphinx I copy over the images as html_static_path
files, and if the path is kept the same in the html, the images would show.在 sphinx 的conf.py
中,我将图像复制为html_static_path
文件,如果路径在 html 中保持相同,图像将显示。
The MyST docs state that it copies.md images but give no configuration options for copying. MyST 文档state 它复制了 .md 图像,但没有提供用于复制的配置选项。 The paragraphs below only reference how to parse HTML files with images.以下段落仅参考如何解析 HTML 带图像的文件。 I did find another option that should treat all links as hyperlinks, but this made no change.我确实找到了另一个应该将所有链接都视为超链接的选项,但这并没有改变。
How do I force MyST to not change the image paths?如何强制 MyST 不更改图像路径?
I think it is more of a convention question.我认为这更像是一个约定俗成的问题。
It is recommended to put _static
in all folder levels and separate assets like images inside each of them, so that links like _static/figures/image.png
resolve to just that folder level.建议将_static
放在所有文件夹级别中,并在每个文件夹中分离图像等资产,以便像_static/figures/image.png
这样的链接仅解析到该文件夹级别。
If you want to use a single top level _static
folder for all folder levels, then your links should be written as /_static/figures/image.png
, where they are resolved to the top level.如果您想为所有文件夹级别使用单个顶级_static
文件夹,那么您的链接应写为/_static/figures/image.png
,它们将在其中解析到顶级。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.