【问题标题】:Can I insert a directive inside another directive - reStructuredText/Sphinx我可以在另一个指令中插入一个指令吗 - reStructuredText/Sphinx
【发布时间】:2012-12-27 04:45:00
【问题描述】:

我想在我的警告指令中插入一张图片:

.. admonition:: John

   Social Network
     .. image: './_static/images/social/facebook.png'
        :target: `facebook`_

但这不起作用。页面内没有显示图片。我该如何解决这个问题?

【问题讨论】:

    标签: python-sphinx restructuredtext


    【解决方案1】:

    您的图像指令中有两个错误。首先,您需要在.. image 之后添加一个冒号 (:)。其次,您不需要在图像文件路径周围加上引号 (')。如果文档中其他地方有有效的 facebook 引用,则以下代码适用于我:

    .. admonition:: John
    
       Social Network
         .. image:: /path/to/facebook.png
            :target: `facebook`_
    

    如果没有第二个冒号,图像只是一个注释(例如,很可能在 HTML 输出中出现)。有关详细信息,请参阅image directive 文档。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-26
      • 1970-01-01
      • 1970-01-01
      • 2020-06-22
      相关资源
      最近更新 更多