-
It looks like you're making some major changes. How do I replicate my simple setup with the old pydoc-markdown of a main.md and the generated API documentation from the TOML description? (In readthedocs, it looks like this.) Can I simply add tags at the bottom of main.md for the various API pages like "Configuration" that you can see below so that they appear under "API Documentation" in the menu on the left as now, or do I have to make one markdown page for each API page (I hope not as that would be a lot of tiny repetitive md files)? Where does the configuration go like loaders, renderer and source_linker or is that not needed any more? My pyproject.toml looks like this: [[tool.pydoc-markdown.loaders]]
type = "python"
search_path = ["src"]
packages = ["hdx.api", "hdx.data", "hdx.facades"]
[tool.pydoc-markdown.renderer]
type = "mkdocs"
output_directory = "docs/build"
[tool.pydoc-markdown.renderer.mkdocs_config]
site_name = "HDX Python API"
theme = "readthedocs"
repo_url = "https://github.com/OCHA-DAP/hdx-python-api"
[tool.pydoc-markdown.renderer.markdown.source_linker]
type = "github"
repo = "OCHA-DAP/hdx-python-api"
[[tool.pydoc-markdown.renderer.pages]]
title = "Home"
name = "index"
source ="docs/main.md"
[[tool.pydoc-markdown.renderer.pages]]
title = "API Documentation"
[[tool.pydoc-markdown.renderer.pages.children]]
title = "Configuration"
contents = ["hdx.api.configuration.*"]
[[tool.pydoc-markdown.renderer.pages.children]]
title = "Locations"
contents = ["hdx.api.locations.*"]
... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hey @mcarans!
Good question! I've been expecting this one to come up and been thinking about it for a while. I'm not entirely sure yet about the extend to which these files should be generated for you automatically, i.e. where is the line between power & control vs. ease of use. For now, I've made a change to Novella 0.1.14 that allows you to create a custom action with your own logic that can be used to generate the files before the Markdown preprocessor runs (which includes Pydoc-Markdown). I've added an example to the Novella documentation here: https://niklasrosenstein.github.io/novella/concepts/#actions template "mkdocs"
def api_pages = {
"Configuration": "hdx.api.configuration",
"Locations": "hdx.api.locations",
# ...
}
action "preprocess-markdown" {
use "pydoc" {
loader().packages = api_pages.values()
}
}
do
name: "generate-api-pages"
closure: {
precedes "preprocess-markdown"
}
action: {
for title, package in api_pages.items():
def filename = directory / 'content' / 'api' / (package + '.md')
filename.parent.mkdir(parents=True, exist_ok=True)
filename.write_text('---\ntitle: {}\n---\n@pydoc {}\n'.format(title, package))
} Currently, the Let me know what you think, absolutely open for input here.
The answer here is mostly "no". The
pydoc-markdown/src/pydoc_markdown/novella/preprocessor.py Lines 56 to 76 in 02713da pydoc-markdown/src/pydoc_markdown/novella/preprocessor.py Lines 26 to 42 in 02713da As a side note: You probably want to place an To have Novella not touch your template "mkdocs"
action "mkdocs-update-config" {
apply_defaults = False
}
|
Beta Was this translation helpful? Give feedback.
-
Closing since the YAML/TOML setup is no longer deprecated |
Beta Was this translation helpful? Give feedback.
Closing since the YAML/TOML setup is no longer deprecated