【问题标题】:Natural Docs comments can't have line breaksNatural Docs 评论不能有换行符
【发布时间】:2013-05-24 11:06:21
【问题描述】:

我正在使用 Natural Docs 从我的 Python 代码生成文档, 我的 Python cmets 是这样的:

Function: get_students



Parameters:
since_data: 

Returns:
res: 

{'count': 

'info': [
'mobile': '15011111111',
'nickname': 'xiaoya',
'gender': 0(unknow) or 1(male) or 2(female),
'level': 0-12,
'register_at': '2013-01-01 08:08:08',
]
}

"""

我的config.txt是这样的:

Language: Python

Extension: py
Shebang String: python
Line Comment: #
Block Comment: """ """
Function Prototype Ender: :
Variable Prototype Ender: =
Line Extender: /

当我得到生成的 html 时,返回值没有换行符,我只能得到这样的换行符:

Returns:
res: 

{'count': \n

'info': [

'mobile': '15011111111',

'nickname': 'xiaoya',

'gender': 0(unknow) or 1(male) or 2(female),
'level': 0-12,
'register_at': '2013-01-01 08:08:08',
]
}

我必须在每行之间添加一个空行以获得换行符。我可以尝试什么来解决这个问题?

【问题讨论】:

    标签: python comments markdown doc


    【解决方案1】:

    源代码中的换行符不会转换为输出中的换行符,以便您可以在多行上编写单个文本段落;无需滚动或使用文本编辑器的自动换行功能。 Web 浏览器也以这种方式呈现 HTML 中的文本段落。

    您似乎希望文档中有一个预先格式化的部分,在您编写它们时带有换行符。我将您的示例封装在 Returns 部分中的 (start code)(end) 行将处理它:

    Returns:
    res: 
    
    (start code)
    {'count': 
    
    'info': [
    'mobile': '15011111111',
    'nickname': 'xiaoya',
    'gender': 0(unknow) or 1(male) or 2(female),
    'level': 0-12,
    'register_at': '2013-01-01 08:08:08',
    ]
    }
    (end)
    

    或者,您可以在示例的每一行前加上 > 前缀,但这会更有效。查看Natural Docs comment formatting 中的代码和文本图部分了解更多信息。

    【讨论】:

      猜你喜欢
      • 2014-07-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-20
      • 1970-01-01
      • 2017-08-06
      • 2020-01-26
      • 2013-03-13
      • 1970-01-01
      相关资源
      最近更新 更多