How to preserve line breaks when generating python docs using sphinx

前端 未结 6 1678
被撕碎了的回忆
被撕碎了的回忆 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:47

    In my particular case, I was trying to get autodoc to read a doc string (""" my doc string """). I ended up using \n everywhere I needed to add a line break:

    This is the first line\n
    and this is the second line\n
    

提交回复
热议问题