简体   繁体   English

防止MyST改变.md图片路径

[英]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.

相关问题 从 myst-parser markdown 文件中引用(生成的 sphynx 自动文档)python 方法 (:py:meth:)? - Refering to a (sphynx autodoc generated) python method (:py:meth:) from a myst-parser markdown file? 可以有狮身人面像 MyST 渲染美人鱼 - It is possible to have sphinx MyST rendering mermaid MyST-Parser:自动链接/链接对错误跟踪器问题的引用 - MyST-Parser: Auto linking / linkifying references to bug tracker issues MyST 允许非连续 header 级别增加 - MyST allowing non-consecutive header level increase 如何将 Doxygen xml output 渲染为 markdown 而不是 Z071B810684D570814BC345B8B8B - How to render Doxygen xml output into markdown instead of reST (using breathe or MyST-Parser) 如何在 readthedocs 中使用 myst_parser 和 sphynx? - How can i use myst_parser with sphynx in readthedocs? 在Sphinx中,当列表中包含.. note ::时,可以防止列表格式更改吗? - In Sphinx, can I prevent the list format from changing when including a .. note:: within the list? 防止 sphinx 重新启动每个文件的节编号 - Prevent sphinx from restarting section numbering every file 防止以下划线结尾的术语在 Sphinx 文档中显示为超链接 - Prevent term ending in an underscore from appearing as hyperlink in Sphinx docs 如何创建包含空格的图像路径? - How to create image paths which contain spaces?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM