Sphinx 将代码格式添加到 :ref:
Sphinx add code formatting to :ref:
我想将代码格式添加到这样的引用中:
:ref:`__slots__ <python:slots>`
我的 intersphinx_mapping
定义 python
是这样的:
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
所以 link 是 https://docs.python.org/3/reference/datamodel.html#slots(slots
在 https://docs.python.org/3/objects.inv
的 std:label
部分定义)
我的目标是将呈现的 link 格式化为 :py:attr:
或类似的样式,而不是 :ref:
呈现的默认文本样式。
None 以下选项有效:
... ``:ref:`__slots__ <python:slots>``` ...
产量输出像
... :ref:`__slots__ <python:slots>`
...
... ``:ref:`__slots__ <python:slots>` `` ...
产量输出如
... __slots__ ...
... :ref:```__slots__`` <python:slots>` ...
产量输出如
... :ref:```__slots__`` <python:slots>` ...
在这种情况下,#id1
有两个独立的内部 link。
... :ref:` ``__slots__`` <python:slots>` ...
产量输出像
... :ref:` ``__slots__`` <python:slots>` ...
在 :ref:
内部或外部用 :code:`...`
或 :literal:`...`
替换 ``...``
也无济于事。事实上,似乎根本不允许嵌套角色。
我想要一个内联角色,它会产生一些用代码风格和 link 呈现的东西,比如
... __slots__
...
如何让基本 :ref:
(或等同物)与 :py:attr:
使用的代码样式格式一起出现?
我在 Anaconda 环境中使用 Sphinx 1.6.3 和 Python 3.6.2。
逆题来了:Sphinx remove code formatting from custom code reference
一个切线相关的问题:
:any:
角色做你想做的事:
:any:`__slots__ <python:slots>`
这是一个 "convenience role",用于查找当前域中的交叉引用目标以及与 :ref:
一起使用的目标。
Python 域有几个 specific cross-reference roles,用于不同类型的对象。
我想将代码格式添加到这样的引用中:
:ref:`__slots__ <python:slots>`
我的 intersphinx_mapping
定义 python
是这样的:
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
所以 link 是 https://docs.python.org/3/reference/datamodel.html#slots(slots
在 https://docs.python.org/3/objects.inv
的 std:label
部分定义)
我的目标是将呈现的 link 格式化为 :py:attr:
或类似的样式,而不是 :ref:
呈现的默认文本样式。
None 以下选项有效:
... ``:ref:`__slots__ <python:slots>``` ...
产量输出像...
:ref:`__slots__ <python:slots>`
...... ``:ref:`__slots__ <python:slots>` `` ...
产量输出如... __slots__ ...
... :ref:```__slots__`` <python:slots>` ...
产量输出如... :ref:```__slots__`` <python:slots>` ...
在这种情况下,
#id1
有两个独立的内部 link。... :ref:` ``__slots__`` <python:slots>` ...
产量输出像... :ref:` ``__slots__`` <python:slots>` ...
在 :ref:
内部或外部用 :code:`...`
或 :literal:`...`
替换 ``...``
也无济于事。事实上,似乎根本不允许嵌套角色。
我想要一个内联角色,它会产生一些用代码风格和 link 呈现的东西,比如
...
__slots__
...
如何让基本 :ref:
(或等同物)与 :py:attr:
使用的代码样式格式一起出现?
我在 Anaconda 环境中使用 Sphinx 1.6.3 和 Python 3.6.2。
逆题来了:Sphinx remove code formatting from custom code reference
一个切线相关的问题:
:any:
角色做你想做的事:
:any:`__slots__ <python:slots>`
这是一个 "convenience role",用于查找当前域中的交叉引用目标以及与 :ref:
一起使用的目标。
Python 域有几个 specific cross-reference roles,用于不同类型的对象。