pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.12k stars 145 forks source link

Syntax Highlighting offline #337

Closed besdollma closed 3 years ago

besdollma commented 3 years ago

This is not really an issue but more of a consultation (but there are no discussions available for this repo).

I see that syntax nightlight is done using Highlight.js, and it is done using their online hosting. However I am hosting the docs in an offline server (on-prem, no internet). Is there any way to achieve syntax highlight in such conditions? Is there any tutorial? Thanks,

kernc commented 3 years ago

From the top of the head, might be as easy as:

# Fetch CDN resources into the current directory
find html -name '*.html' | xargs grep -oP 'https://cdnjs[^"]*' | wget -i -
# Replace CDN resources with local ones, based in document root (/)
find html -name '*.html' | xargs sed -iE 's,https://cdnjs([^"]*?/)+,/,g'

This is a duplicate of https://github.com/pdoc3/pdoc/issues/136 (please subscribe there). Though, with fairly graceful degradation we do (everything is still readable offline) and with easy workarounds available (as above), unless there are better, simple ideas, I'm leaning to wontfix.