【问题标题】:Preformatted (verbatim) hyperlink in Sphinx-reST-RTDSphinx-reST-RTD 中的预格式化(逐字)超链接
【发布时间】:2019-11-23 10:40:41
【问题描述】:

我正在使用 Sphinx-RTD 构建文档。

我想在某处有一个链接,并将其样式设置为逐字或预格式化文本。

例如,假设我有这个逐字记录:

ALTER TABLE

有没有办法将它链接到某个地方,比如 :ref:... 或者甚至只是一个标准的超链接?

【问题讨论】:

    标签: python-sphinx restructuredtext read-the-docs


    【解决方案1】:

    如果我没记错的话,"Replacement Text" directive 可以提供帮助。

    由于 reStructuredText 不支持嵌套的内联标记,使用样式文本创建引用的唯一方法是使用带有“replace”指令的替换:

    I recommend you try |Python|_.
    
    .. |Python| replace:: Python, *the* best language around
    .. _Python: http://www.python.org/
    

    所以可能是这样的:

    Click |altertable|_ to read details about |altertable|.
    
    ----
    
    Blah blah blah
    
    ----
    
    .. _altertable:
    
    Here are the details about |altertable|: blah blah blah.
    
    .. |altertable| replace:: ``ALTER TABLE``
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-30
      • 2011-10-07
      • 2010-11-16
      • 1970-01-01
      • 1970-01-01
      • 2022-01-09
      • 2013-06-03
      • 2011-09-30
      相关资源
      最近更新 更多