重新删除线
是否有可能在重组文本中敲击文本?
例如,当转换为HTML时,呈现为<strike>标记,例如: ReSTructuredText 
我按VilleSäävuori的build议更好地检查了文档,并决定添加这样的删除线:
 .. role:: strike :class: strike 
在文件中,这可以应用如下:
 :strike:`This text is crossed out` 
 然后在我的css文件中有一个条目: 
 .strike { text-decoration: line-through; } 
至less有三种方法可以做到这一点:
 .. role:: strike An example of :strike:`strike through text`. .. container:: strike Here the full block of test is striked through. An undecorated paragraph. .. class:: strike This paragraph too is is striked through. .. admonition:: cancelled :class: strike I strike through cancelled text. 
 应用rst2html您会得到: 
 <p>An example of <span class="strike">strike through text</span>.</p> <div class="strike container"> Here the full block of test is striked through.</div> <p>An undecorated paragraph.</p> <p class="strike">This paragraph too is is striked through.</p> <div class="strike admonition"> <p class="first admonition-title">cancelled</p> <p class="last">I strike through cancelled text.</p> 
你用一种风格来使用它们
 .strike { text-decoration: line-through; } 
 在这里,我以admonition指令为例,但任何允许:class:选项的指令都可以。 
 由于它生成一个span , role指令是唯一允许将样式应用到段落的一部分的指令。 
 因为指令名是html输出的默认类,所以build议Gozzilli添加类strike是多余的。 
 我已经用rest2html和Sphinx检查了这些语法。 但是,尽piperest2html一切正常, class指令与狮身人面像失败。 你必须replace它 
 .. rst-class:: strike This paragraph too is is striked through. 
只有在Sphinx reSt Primer的小脚注中 才提到。
根据官方的规范 ,在ReST中没有删除线标记的指令 。
但是,如果环境允许:raw:angular色,或者您可以编写自己的angular色,则可以为其编写自定义插件。
我发现其他答案非常有帮助。 我对狮身人面像不是很熟悉,但我正在使用它作为一个项目。 我也希望能够突破这个能力,并且根据以前的答案进行工作。 清楚的是,我join了删除线的angular色,就像gozzilli提到的那样,但是我使用rst_prologvariables将其保存在conf.py中,如在这里的堆栈溢出线程中所讨论的。 这意味着这个angular色可用于所有的rest文件。
 然后,我通过在我的源代码目录中的_templates内创buildlayout.html扩展基本html模板。 这个文件的内容是: 
 {% extends "!layout.html" %} {% set css_files = css_files + ["_static/myStyle.css"] %} 
这基本上包括一个自定义的CSS文件到所有你build立的默认HTML文档。
 最后,在我的源代码目录中的_static目录中,我包含了myStyle.css文件,其中包含: 
 .strike { text-decoration: line-through; } 
其他答案已经提供。
我只是写这个答案,因为对于我来说,用我有限的狮身人面像经验来编辑这个文件并不明显。