epydoc:固定宽度文本块
我编写了一个依赖配置文件的软件组件。为了清楚起见,我想通过在相关类的文档字符串中添加示例文件来记录配置文件的结构。由于显而易见的原因,它应该以固定宽度字体显示。
我知道的唯一方法是在每行之前添加 >>>
,这很糟糕,因为 doctest 可能会认为这是一个 Python 代码段并失去理智。而且,它看起来真的很难看:
>>>
[db]
>>>
port = 5432
>>> name = adam_db
...
我真正想要的是:
[db]
端口=5432
名称=adam_db
...
采用固定宽度字体。
有什么想法吗?
谢谢,
亚当
I have written a software component that relies on a configuration file. For clarity, I want to document the structure of the configuration file by adding an example file in the docstring of the relevant class. For obvious reasons, it should appear in fixed-width font.
The only way I know is adding >>>
before each line, which is bad because doctest might think this is a Python code segment and lose its wits. Moreover, it looks really ugly:
>>>
[db]
>>>
port = 5432
>>>
name = adam_db
...
What I really want is:
[db]
port=5432
name=adam_db
...
In a fixed-width font.
Any ideas?
Thanks,
Adam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以使用 文字块 选项。
Maybe you could use the Literal Block option.