如何在使用SPHINX生成Python文档时保留换行符 [英] How to preserve line breaks when generating python docs using sphinx

查看:24
本文介绍了如何在使用SPHINX生成Python文档时保留换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Sphinx为一个python项目生成文档。 输出的html不会保留文档字符串中出现的换行符。 示例:

代码

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

您知道如何修复它吗?

推荐答案

通常在重构文本中使用

| Vertical bars
| like this

保留换行符

这篇关于如何在使用SPHINX生成Python文档时保留换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆