sphinx_gallery.directives#

自訂 Sphinx 指令。

函式#

sphinx_gallery.directives.depart_imgsg_html(self, node)[原始碼]#

HTML 離開節點訪問器函式。

類別#

class sphinx_gallery.directives.ImageSg(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[原始碼]#

實作允許選用 hidpi 影像的指令。

用於 image_srcset 設定選項。

例如:

.. image-sg:: /plot_types/basic/images/sphx_glr_bar_001.png
    :alt: bar
    :srcset: /plot_types/basic/images/sphx_glr_bar_001.png,
             /plot_types/basic/images/sphx_glr_bar_001_2_00x.png 2.00x
    :class: sphx-glr-single-img

產生的 HTML 為

<img src="sphx_glr_bar_001_hidpi.png"
    srcset="_images/sphx_glr_bar_001.png,
            _images/sphx_glr_bar_001_2_00x.png 2x",
    alt="bar"
    class="sphx-glr-single-img" />
final_argument_whitespace = False#

最後一個引數是否可以包含空白?

has_content = False#

指令是否可以有內容?

option_spec = {'alt': <function unchanged>, 'class': <function class_option>, 'srcset': <function unchanged>}#

選項名稱對應到驗證器函式。

optional_arguments = 3#

在必要引數之後的可選引數數量。

required_arguments = 1#

必要指令引數的數量。

run()[原始碼]#

更新節點內容。