在 reStructuredText CSV 表中创建引用 [英] Create a reference inside a reStructuredText CSV table

查看:26
本文介绍了在 reStructuredText CSV 表中创建引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的 CSV 表

I have a CSV table like this

.. csv-table::
   :header: Name, BrowseName, DataType, Description
   :widths: 16,16,16,52

   "Enabled", "Enabled", "Boolean", "Alarm can..."

我想创建对 HTML 输出中一行的引用.我试图将 .. _reference: 放在表中的每个位置,但是我有一个编译错误或一个空单元格.我也尝试使用 reST 替换定义,但没有成功.

and I would like to create a reference to a row in the HTML output. I tried to put .. _reference: to every place in the table, but either I have a compile error or an empty cell. I tried also to use a reST substitution definition, but without success.

你知道有没有办法在那种表中添加这样的引用,或者引用只能在网格表中使用?

Do you know if there is a way to add such a reference in that kind of table or references work only within grid tables?

推荐答案

你可以在你的 CSV 中插入任意的 reST,类似于 这个答案.对齐很棘手,因此我建议将所有内容统一缩进 4 个空格.根据 :ref: 角色.

You can insert arbitrary reST in your CSV, similar to this answer. The alignment is tricky, so I recommend indenting everything uniformly by 4 spaces. The label is inserted in the second row and the :ref: directive must be given both a title and the label, per Sphinx's documentation on the :ref: role.

:ref:`link to hello <mylabel>`

.. csv-table:: Test csv-table with multi-paragraph
    :header: "a", "b", "c"

    Cat,"Chunk that is updated periodically via copy-and-paste.

    Line #2, #3, etc", "Kitten"
    Dog,".. _mylabel:

    Hello", "Puppy"
    Walrus,"#.  List Item 1
    #.  List Item 2
    #.  List Item 3", "Pup"

这篇关于在 reStructuredText CSV 表中创建引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆