pdoc
pdoc copied to clipboard
Offline html output
Expected Behavior
To generate an offline document, using pdoc, I found that I can generate pdf document but the pdf doc seems a little confusing. The html output is pretty but link to some online assets such as https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css, so this option is not available for a offline project. A extra option to scratch those static assets and "freeze" them in a local directory maybe very useful.
Additional info
- pdoc version: 0.7.2
I've been after the same offline use issue and found this issue, plus the mentioned #337. The latter is a good start, but I had to elaborate a bit more to actually get it working without CORS problems, since the browser sees the files with a file:// protocol. My postprocessing looks like this:
for htmlfile in $(find . -name '*.html'); do
pushd $(dirname ${htmlfile})
bn=$(basename ${htmlfile})
grep -oPh 'https://cdnjs[^"]*' ${bn} | sort | uniq | wget -nc -i -
sed -i -E 's,https://cdnjs([^"]*?/)+,,g' ${bn}
sed -i -E 's, integrity=".*?",,g' ${bn}
sed -i -E 's, crossorigin>,>,g' ${bn}
popd
done
It is not very clean, as the same resources are downloaded to each and every subdirectory, but at least it works.