NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
458 stars 102 forks source link

How can I just get a raw output of markdown? #171

Closed ethankoch4 closed 3 years ago

ethankoch4 commented 3 years ago

If I have a project that looks like this:

foo
├── bar
│   ├── corge.py
│   └── qux.py
├── baz.py
└── quux.py

How can I get markdown API docs in this format saved to disk?:

foo-docs
└── foo
    ├── bar
    │   ├── corge
    │   │   ├── class-garply.md
    │   │   ├── class-grault.md
    │   │   └── index.md
    │   ├── index.md
    │   └── qux
    │       ├── class-qux.md
    │       └── index.md
    ├── baz
    │   ├── class-waldo.md
    │   └── index.md
    ├── index.md
    └── quux
        ├── class-fred.md
        ├── class-quux.md
        └── index.md

you'll see in the above that:

  1. each module has its own directory in the docs with a corresponding index.md
  2. each class in each module also has its own file
  3. there is a top-level index.md

pdoc3 does this, the only issue is that they output html :(

Any help would be appreciated. Thanks!

NiklasRosenstein commented 3 years ago

Hi @ethankoch4 ,

To get the exact folder structure that you are looking for you would need to write a renderer plugin. Currently there is the generic MarkdownRenderer which can render a set of "api objects" into markdown format in a single file, and that renderer is also used by the MkdocsRenderer, HugoRenderer and DocusaurusRenderer which produce the folder structure according to what's needed for the tool they are targeting.

In theory there could be a renderer that allows you to exactly describe the folder layout in YAML, but that doesn't currently exist.

ethankoch4 commented 3 years ago

Thanks for responding! If I write a Renderer (also maybe plumb through a CLI option) would a PR be welcome?

NiklasRosenstein commented 3 years ago

Hey @ethankoch4 , a PR is welcome if your renderer plugin doesn't just fit a niche use case but is applicable more broadly (such as, but not limited to, a generic plugin that allows you to define the directory layout in YAML). 🙂

NiklasRosenstein commented 3 years ago

Closing due to inactivity