ReST strikethrough

后端 未结 7 1201
悲&欢浪女
悲&欢浪女 2020-12-02 09:50

Is it possible to strike text through in Restructured Text?

Something that for example renders as a tag when converted to HTML, like:

7条回答
  •  抹茶落季
    2020-12-02 10:30

    I found the other answers very helpful. I am not very familiar with Sphinx but I am using it for a project. I too wanted the strike-through ability and have got it working based on the previous answers. To be clear, I added my strikethrough role as gozzilli mentioned but I saved it inside my conf.py using the rst_prolog variable as discussed in the stack overflow thread here. This means that this role is available to all of your rest files.

    I then extended the base html template as described above by creating layout.htmlwithin _templatesinside my source directory. The contents of this file are:

    {% extends "!layout.html" %}
    {% set css_files = css_files + ["_static/myStyle.css"] %}
    

    This basically includes a custom css file to all your built default html docs.

    Finally, in my _static directory within my source directory I included the file myStyle.css which contains:

    .strike {
      text-decoration: line-through;
    }
    

    Which the other answers have already provided.

    I am merely writing this answer as it wasn't obvious to me with my limited Sphinx experience which files to edit.

提交回复
热议问题