Format text in a link in reStructuredText

前端 未结 4 2066
再見小時候
再見小時候 2020-11-28 22:57

How do you format text within a denoted link in reStructuredText?

Specifically, I wish to generate the following HTML from my rst:



        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 23:05

    If you want to essentially do get HTML/CSS equivalent of

    This is red text
    

    in reStructuredText using Sphinx, you can do this by creating a role:

    .. role:: red
    

    Then you use it like this:

    :red:`This is red text`
    

    There should be only one tick mark ` at the end of the line above. You, of course, have to have

    .red { color: red }
    

    in your CSS file.

提交回复
热议问题