在sphinx中描述json文档结构
sphinx-jsondomain的Python项目详细描述
我很惊讶,当我想去的时候,这个地方已经不存在了。
在使用sphinxcontrib-httpdomain之外描述json文档
记录我的一个api。此扩展简化了对结构化
使用新Sphinx domain的json文档。
..json:object:: Github User What Github's API thinks a user looks like. :property string login:the user's login:property integer id:Github assigned unique user identifier:property string avatar_url:url to user's selected avatar image or the empty string :property string gravatar_url:url to the user's gravatar image or the empty string
这将格式化为一些漂亮的东西并引用 :json:object:`github user`按预期工作。见online examples 为了更好地了解什么是可能的。
快速启动
安装sphinx和sphinx-jsondomain包:
$ python3 -mvenv env $ env/bin/pip install -q sphinx sphinx-jsondomain
设置sphinx文档根目录并构建文档集:
$ env/bin/sphinx-quickstart -p my-project -r 0.0 -v 0.0.0 \ > -a 'Dave Shawley <daveshawley@gmail.com>' --quiet docs $ env/bin/sphinx-build -b html docs build/sphinx/html
现在,在docs/conf.py中找到extensions定义并添加 sphinxjsondomain结束。将json:object指令添加到 docs/index.rst并再次运行sphinx build以查看结果。