[英]Python-Sphinx documentation: link source code
I have a dictionary that represent a schema (JSON-Schema to be more precise). 我有一个表示模式的字典(JSON-Schema更精确)。
Sometimes the schema gets complex and in the documentation I need to link to it in order to give a better picture. 有时架构变得复杂,在文档中我需要链接到它以便提供更好的图片。
I have the viewcode
extension enabled, I tried the following with no luck: 我启用了
viewcode
扩展,我尝试了以下没有运气:
.. data:: netjsonconfig.backends.openvpn.schema.schema
.. automodule:: netjsonconfig.backends.openvpn.schema
The dictionary python path is netjsonconfig.backends.openvpn.schema.schema
. 字典python路径是
netjsonconfig.backends.openvpn.schema.schema
。
Is it possible to achieve this? 是否有可能实现这一目标? If yes how?
如果有,怎么样?
Try this: 尝试这个:
.. literalinclude:: your_json_filename.json
:language: json
You can even select a part of this file to display by 您甚至可以选择要显示的此文件的一部分
.. literalinclude:: your_json_filename.json
:language: json
:lines: 18-43
This displays the lines 18 to 43 of your_json_filename.json . 这将显示your_json_filename.json的第18行到第43 行 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.