【问题标题】:Inserting an inline icon in an .rst file在 .rst 文件中插入内联图标
【发布时间】:2026-01-14 19:35:01
【问题描述】:

我正在尝试将内联图像插入 .rst 文件,但没有成功。我尝试复制之前技术作家使用的语法,如下所示:

|图标复制|

上述语法引用的图像文件的名称是studio_icon_copy。但是,创建一个名为 studio_icon_additional 的图像文件并使用 |icon-additional| 语法不起作用。我验证了这是用于所有内联图像工作实例的语法。

我还验证了我正在使用的文件夹中的 studio_icon_copy 确实是正确的图像,方法是对其进行轻微更改并验证我是否在前端看到了更改。我还确保我创建的新图像在同一个文件夹中。

我什至尝试将正确的语法复制并粘贴到所需的位置,然后简单地将 copy 替换为 additional,但也没有用。

不管怎样,我使用 Notepad++ 并在 GitHub 中工作。尝试上述方法后,我不知道如何正确插入它,尽管我很确定我错过了一些东西。

谢谢。

【问题讨论】:

标签: image github inline restructuredtext


【解决方案1】:

https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-definitions 的实际报价说:

The |biohazard| symbol must be used on containers used to
dispose of medical waste.

.. |biohazard| image:: biohazard.png

其实应该是这样的:

.. |biohazard| image:: biohazard.png

The |biohazard| symbol must be used on containers used to
dispose of medical waste.

总是声明 |pic|在引用它之前。我认为对此进行了一些更改,并且文档实际上并未更新。您可以随时添加选项以使其非常小,然后您可以确定它在文本旁边看起来不错:

.. |biohazard| image:: biohazard.png
   :height: 25px

【讨论】:

    最近更新 更多