Make viewcode show module sources

一曲冷凌霜 提交于 2021-02-10 02:28:08

问题


I am trying to make a cookbook out of some Python snippets using Sphinx. Each snippet is a self-contained Python script and has a tutorial-type doctsring.

I want to have a source link in the generated documentation to display the script contents. But viewcode does not seem to create this link for the module, but only for a function or a class with a docstring. Is there a way to coax sphinx.ext.viewcode to display the script code without having any class/function in it?


回答1:


I hope you haven't sat for two years waiting for an answer, but try using the literal include tag. You can play around with what gets displayed.

See the sphinx docs for more details.



来源:https://stackoverflow.com/questions/25565677/make-viewcode-show-module-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!