-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top-level documentation of namespace packages? #301
Comments
For the duration of building the docs, can you write an # namespace/__init__.py:
""".. include:: relative/path/to.md""" using the Does this work for namespace packages? 🤔 |
Interesting hack, I'll look into it. It's certainly possible (in the sense that I fully control the project and don't mind wrapping docs building in a shell script) but I'll need to see if it produces the intended results (it will not be recognized as a namespace package any more most likely, but that's actually OK for documentation purposes in my case). |
Ok, I tried this and it doesn't work for me: The problem here is that if I add an My only other idea is to run My ideal scenario would be |
Currently, Lines 8 to 14 in 72e41db
This sounds fairly specific. Including extra pages/content has been discussed before: #233, #115. I don't think anyone's been considering the files — we kinda use our own config file: pdoc/pdoc/templates/config.mako Lines 1 to 3 in 72e41db
One alternative way would be to just use the submodules' generated docs and construct the index/intro page from scratch. |
Ah, I was unaware of that config file 👍 . Could there be a I'm happy to work on a PR for this, but I will probably solve my issue in a different way if this doesn't sound like a good idea to you. |
I don't vehemently oppose it, but:
pdoc can be run as
Which would be the main index file? Can we think of a generic, customizable solution (such as passing a dict or a callable)? |
Ah, I understand. In that case, my understanding of such a "main index file" would be one that sits here:
And looks somewhat like this:
In other words, it would be a list of the documented modules that were passed (similar to how it documents namespace packages in my OP example) plus the explicitly designated readme doc at the top. Just to be clear, I don't want my idea to change default behavior, just provide a way to optionally insert an introductory .md file in the absence of a |
Just wanted to add: I'm curious by the potential to add this as it would benefit my direct use case, but I'm not going to be pushy about it if this is out of scope / too edge-casey for your current roadmap. I definitely prefer fixing my own documentation with a bash hack than insisting on a feature that doesn't make sense, but happy to contribute it if we can hash it out in a way that seems generally useful :) |
So when running
The list of modules is then kind of like what Otherwise, I'm a fan of simple bash recipes. Their span and versatility is unmatched. 😃 |
Ah, interesting discussion over there, I like those drafts... I patched my urgent needs with the following code for now
#!/bin/bash
pdoc3 --output-dir docs --html --force mymodule
python3 docs/doc-postprocess.py
import markdown
INTRO = 'docs/introduction.md'
INDEX = 'docs/snout/index.html'
INSERT_AT = '<section id="section-intro">'
if __name__ == "__main__":
with open(INTRO, 'r') as f:
intro = f.read()
with open(INDEX, 'r') as f:
index = f.read()
with open(INDEX, 'w') as f:
f.write(index.replace(INSERT_AT, f'{INSERT_AT}\n{markdown.markdown(intro)}')) Which works fairly well for my specific case. I'm interested in #101 though -- seems like it's kinda orphaned, does that mean you want someone to look into it and flesh this feature out some more? |
Absolutely; if you can prepare a PR, I'd be happy to review it and work towards merging it. Let's call this a duplicate of #101 then. |
If anyone else is struggling with this and wants another option, my solution without any code modifications was to put my toplevel documentation in an additional namespace package called |
Expected Behavior
My project consists of multiple modules packaged in a namespace package (because some additional sub-modules are managed in separate repos). I would like to add a high-level introductory chapter to my documentation (i.e., on the "home page" of the HTML output). I am running
pdoc3 --output-dir docs --html packagedir
to generate documentation.Actual Behavior
When I run the command above, I'm getting documentation on all sub-modules, but I would like to import a Markdown file above the "Sub-modules" headline.

Is this possible somehow?
Steps to Reproduce
N/A (see above)
Additional info
The text was updated successfully, but these errors were encountered: