Is it possible to strike text through in Restructured Text?
Something that for example renders as a
tag when converted to HTML, like:
There is at least three ways of doing it:
.. 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.
After applying rst2html
you get:
An example of strike through text.
Here the full block of test is striked through.
An undecorated paragraph.
This paragraph too is is striked through.
cancelled
I strike through cancelled text.
You use them with a style
.strike {
text-decoration: line-through;
}
Here I have taken the admonition
directive as example but any
directive that allow the :class:
option would do.
As it generates a span
the role
directive is the only one that
allow to apply your style to a part of a paragraph.
It is redundant to add a class strike
to a directive also named
strike
, as suggest Gozzilli, because the directive name is the default
class for the html output.
I have checked these syntax both with rest2html
and Sphinx. But
while everything works as expected with rest2html
the class
directive fail with Sphinx. You have to replace it with
.. rst-class:: strike
This paragraph too is is striked through.
This is only stated in a small
footnote of Sphinx reSt Primer.