好的,所以我发现以下方法有效:
+-------------------------+-------------------------+
| | |
|.. code-block:: |.. code-block:: |
| | |
| # Code example 1 | # Code example 2 |
| | |
+-------------------------+-------------------------+
这将创建一个包含两列的表,并在每一列中放置一个代码块。如果两个块的行数相同,它们将相互对齐。输出如下所示:
如果想包含外部脚本,可以这样做:
+--------------------------------+--------------------------------+
| | |
|.. literalinclude:: script_1.py |.. literalinclude:: script_2.py |
| | |
+--------------------------------+--------------------------------+
我正在尝试这个,但它不适用于多行代码,看来RST不支持这个
.. list-table:: Defining World Geometry
:widths: 50 50
:header-rows: 1
* - Gate 9
- Gate 10
* - .. code-block::
/gate/world/geometry/setXLength 10. cm
/gate/world/geometry/setYLength 10. cm
/gate/world/geometry/setZLength 15. cm
/gate/world/setMaterial Air
- .. code-block:: python
sim.world.size = [10 * cm, 10 * cm, 15 * cm]
Pandoc 在代码部分之外渲染代码
+-----------------------------------+-----------------------------------+
| Gate 9 | Gate 10 |
+===================================+===================================+
| ``` | ``` python |
| ``` | ``` |
| | |
| /gate/world/geometry/setXLength | sim.world.size = \[10 \* cm, 10 |
| 10. cm | \* cm, 15 \* cm\] |
| /gate/world/geometry/setYLength | |
| 10. cm | |
| /gate/world/geometry/setZLength | |
| 15. cm /gate/world/setMaterial | |
| Air | |
+-----------------------------------+-----------------------------------+
: Defining World Geometry