Search code examples
pythonpython-sphinxrestructuredtextstrikethrough

How to strikethrough substrings without spaces in Sphinx?


I need to strike substrings without spaces in Sphinx .rst file to transform it to HTML in a similar manner as <span style="text-decoration: line-through;">strike</span>substring. The following example is not working for me. Is it possible?

conf.py

extensions = ["sphinxnotes.strike"]

index.rst

:strike:`strike`substring

Solution

  • It's a known peculiarity of ReStructuredText, see, e.g., Part of a word bold in reStructuredText.

    All you need is an escaped space after the substring:

    :strike:`strike`\ substring