Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to preserve line breaks when generating python docs using sphinx

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

def testMethod(arg1,arg2):     """     This is a test method      Arguments:     arg1: arg1 description     arg2: arg2 description      Returns:     None     """     print "I am a test method" 

Sphinx O/P:

TestModule.testMethod(arg1, arg2)  This is a test method  Arguments: arg1: arg1 description arg2: arg2 description  Returns: None 

Any idea how to fix it ?

like image 435
Saurabh Saxena Avatar asked Aug 11 '11 21:08

Saurabh Saxena


People also ask

What is rst Sphinx?

RST stands for ReStructured Text. It is the standard markup language used for documenting python packages. Sphinx is the Python package that generates an html website from RST files, and it is what we are using to generate this site.


1 Answers

In general in restructured text use

| Vertical bars | like this 

to keep line breaks

like image 153
Owen Avatar answered Sep 28 '22 11:09

Owen