How to preserve line breaks when generating python docs using sphinx

前端 未结 6 1680
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 04:10

I am using Sphinx for generating docs for a python project. The output html is not preserving the line breaks which are present in the docstring. Example:

Code

6条回答
  •  天涯浪人
    2020-12-05 04:38

    If you add the following to your main .rst file:

    .. |br| raw:: html
    
       

    Then in your markup you can add in |br| to create linebreaks just for HTML.

    I want to break this line here: |br| after the break.
    

    From: http://docutils.sourceforge.net/FAQ.html#how-to-indicate-a-line-break-or-a-significant-newline

提交回复
热议问题