Closed ogallagher closed 3 years ago
Rendering to HTML always takes html.mako template, but you can influence the directory where html.mako is sought (programatically) by amending pdoc.tpl_lookup
:
https://github.com/pdoc3/pdoc/blob/72e41dbf91646a39bc900ca6f875e5f75660e6a4/pdoc/__init__.py#L54-L66
or (CLI) via --template-dir
:
https://github.com/pdoc3/pdoc/blob/72e41dbf91646a39bc900ca6f875e5f75660e6a4/pdoc/cli.py#L105-L112
Curious to see what you end up with! :eyes:
@kernc Thank you! I’ll attempt amending pdoc.tpl_lookup.directories
and will see how it goes.
I’ve managed to, at least in terms of utility, achieve what I was looking for. After inserting my custom template directory as
the first element in pdoc.tpl_lookup.directories
, I then copied the default mako template files into the new location
and made some modifications. I only extracted key snippets in part due to the required secrecy of the project involved, but others interested in customizing the generated html output from pdoc could use this as an example:
${link(item, item.name)}
Here's what my result looks like:
Notably I forgot to sort members alphabetically within each class member, but that should be trivial compared to what’s done already.
It would be great if this behaviour could be added as an option to pdoc. My JS/CSS/HTML isn't good enough to pick up the posted files and just use them in my project, unfortunately!
The current default layout for the generated html pages includes an index/navigation bar along the left side, organized like so:
I would much prefer that within each class, the members be better organized (and also collapsible), much like how they’re organized in the main section of the page:
How do I add a custom template with a different file path to be used instead of
pdoc/templates/html.mako
? In the documentation forModule.html(self, minify=True, **kwargs) --> str
I’m not seeing an indication that this is possible.