替换 #### 本地版 ====== 1. 本地版- ``|logo|`` 代替此图片:: // 在最后做如下定义, 在整个文中可用 .. |logo| image:: ../files/image/photo.jpg :width: 20pt :height: 20pt :align: middle 这儿这么用: |logo| .. |logo| image:: ../files/image/photo.jpg :width: 20pt :height: 20pt :align: middle 这儿这么用: |logo| 2. 本地版-代替一段话:: .. |longtext| replace:: this is a longish text to include within a table and which is longer than the width of the column. 这儿这么用: |longtext| .. |longtext| replace:: this is a longish text to include within a table and which is longer than the width of the column. 这儿这么用: |longtext| 3. 代替原始 html:: .. |raw-html| raw:: html

hello

raw代码展示: |raw-html| .. |raw-html| raw:: html

hello

raw代码展示: |raw-html| 4. 自定义role:: .. role:: raw-custom(raw) :format: html :raw-custom:`左边是注释(不显示), 这儿是代码(显示).` **<左边是 raw 代码,这儿是sphinx 语法>** .. role:: raw-custom(raw) :format: html :raw-custom:`左边是注释(不显示), 这儿是代码(显示).` **<左边是 raw 代码,这儿是sphinx 语法>** 全局版 ====== :: // In your conf.py: my_config_value = 42 rst_epilog = '.. |my_conf_val| replace:: %d' % my_config_value // In your .rst source: My config value is |my_conf_val|! // In your output: My config value is 42!