pdoc icon indicating copy to clipboard operation
pdoc copied to clipboard

include local logo assets in pdoc output

Open khusmann opened this issue 1 year ago • 0 comments

Problem Description

When running pdoc in autoreload/preview mode, I was having trouble getting local logo images to work:

pdoc my_module --logo logo.png

Where logo.png is a file in the current directory I'm running pdoc from.

Similarly, if I create an output:

pdoc my_module --logo logo.png -o docs

I need to manually copy the logo into the output dir: cp ./logo.png docs, which makes it clear that --logo arg is a path relative to the hosted root. I cannot find a way of making a local logo work in autoreload/preview mode.

Proposal

It'd be nice when I specify a local image file, the asset is just included in the build.

Alternatives

Perhaps instead we could have a flag for --include-asset-dir or something that I could point to a directory that holds all the assets for the docs? For example, say I had a project with the following dir structure:

my_module
assets/logo.png
pyproject.toml

In the root project dir, I'd go

pdoc ./my_module --logo /logo.png --include-asset-dir ./assets -o docs

And it would copy the contents of ./assets into docs:

docs/index.html
docs/my_module.html
docs/logo.png
(etc)

Extra context

It's very possible there's already a way to handle this that I'm just missing... if so, please let me know how I should be approaching this! Thanks.

khusmann avatar Dec 22 '24 23:12 khusmann