0

输出是否help(something)遵循一些易于在 html 中格式化的标记语言?我知道pydoc -w [topic]但有两个问题:

  • 风格的定制并不容易(http://bugs.python.org/issue10716)和
  • pydoc -w某些主题失败(http://stackoverflow.com/a/10333615/1318686)

下面是一些由 生成的示例输出help('def')。它具有其他标记语言的一些典型特征。例如代码块的空格,内联代码的`,高亮的**...

有任何想法吗?

谢谢!

Function definitions
********************

A function definition

Multiple decorators are applied in
nested fashion. For example, the following code:

   @f1(arg)
   @f2
   def func(): pass

just like a function defined by a lambda form.  The "``def``" form is
actually more powerful since it allows the execution of multiple
statements.

**Programmer's note:** Functions are first-class
4

1 回答 1

1

大多数人使用reStructuredText并使用Sphinx将其转换为 HTML 和其他格式。

但是,对于如何格式化函数的文档字符串没有要求。

于 2012-04-26T22:00:45.087 回答