Automatically Generate GitHub Wiki Documentation from Python Docstrings
Asked Answered
J

2

22

The title says it all. What I imagine is to have docstrings for all of my modules, classes and functions and somehow nicely navigate the doc via github (wiki?). Also, the doc should be in sync with latest code meaning it should be updated/re-generated on push. Is that possible?

Jonquil answered 15/4, 2015 at 20:39 Comment(4)
Sphinx is definitely it, although it uses restructuredText rather than Markdown. For Markdown, there is mkdocs, but that doesn't support docstrings. Although, I did start this experiment (which may be a bad idea): github.com/waylan/mddocManthei
I had the same problem (readme.md) and I do not believe there is a nice answer. I tried mkdocs —just polluted my folder— and pydoc_markdown, the top Google hit, which gave a fraction of the text pydoc gave. In the end I simply got the pydoc output and did a three or four search and replaced a few items.Dusa
We've noticed that the Github per-repo wikis aren't tied to the main repo commits, meaning that if you want accurate per-commit documentation (so that any commit checked out has the right doc for it), the per-repo wiki is useless.Lubricious
Is it possible to show some minimal example of what you start with and the md you want to finish with?Unseam
O
2

Just pipe the output of the generated docstring to a .md file.

Like this:

pydoc example_lib > example_lib.md .
Om answered 26/11, 2017 at 23:29 Comment(0)
D
0

Pydoc doesn't generate markdown, it generates an ad-hoc text markup that only occasionally by luck matches markdown. You would need to have an ad-hoc text to markdown converter, which will fail a lot, same as using the raw ad-hoc text as if it already were markdown.

Domel answered 28/11, 2021 at 20:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.