diff --git a/Dockerfile b/Dockerfile index 39518e4..126799e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,24 @@ ARG FROM_SOURCE=squidfunk/mkdocs-material FROM ${FROM_SOURCE} +RUN apk add --no-cache py3-pip py3-pillow py3-cffi py3-brotli gcc musl-dev python3-dev pango build-base libffi-dev jpeg-dev libxslt-dev + RUN pip install \ mkdocs-autolinks-plugin \ mkdocs-htmlproofer-plugin \ mkdocs-git-revision-date-localized-plugin \ mkdocs-macros-plugin \ mkdocs-git-committers-plugin-2 \ - mkdocs-meta-descriptions-plugin + mkdocs-meta-descriptions-plugin \ + mkdocs-with-pdf + +# Theoretically this could add support for headless chrome +RUN apk add --no-cache \ + chromium \ + nss \ + freetype \ + harfbuzz \ + ca-certificates \ + ttf-freefont \ + nodejs \ + yarn diff --git a/mkdocs-pdf-print.yml b/mkdocs-pdf-print.yml new file mode 100644 index 0000000..da0f2b1 --- /dev/null +++ b/mkdocs-pdf-print.yml @@ -0,0 +1,39 @@ +# Used to trigger a PDF build of the site +INHERIT: mkdocs.yml +plugins: + with-pdf: + author: David Young + copyright: ANY TEXT + + cover: false + back_cover: true + cover_title: TITLE TEXT + cover_subtitle: SUBTITLE TEXT + custom_template_path: TEMPLATES PATH + toc_title: TOC TITLE TEXT + heading_shift: false + toc_level: 3 + ordered_chapter_level: 2 + excludes_children: + - 'release-notes/:upgrading' + - 'release-notes/:changelog' + + exclude_pages: + - 'bugs/' + - 'appendix/contribute/' + convert_iframe: + - src: IFRAME SRC + img: POSTER IMAGE URL + text: ALTERNATE TEXT + - src: ... + two_columns_level: 3 + + render_js: true + headless_chrome_path: headless-chromium + + output_path: any-place/document.pdf + enabled_if_env: ENABLE_PDF_EXPORT + + debug_html: true + show_anchors: true + verbose: true diff --git a/scripts/build-insiders.sh b/scripts/build-insiders.sh index b48fb71..3aa9f38 100755 --- a/scripts/build-insiders.sh +++ b/scripts/build-insiders.sh @@ -1,3 +1,3 @@ #!/bin/bash -docker build --build-arg FROM_SOURCE=ghcr.io/geek-cookbook/mkdocs-material-insiders . -t funkypenguin/mkdocs-material +docker build --build-arg FROM_SOURCE=ghcr.io/geek-cookbook/mkdocs-material-insiders . -t funkypenguin/mkdocs-material --platform amd64 docker run --rm --name mkdocs-material -v ${PWD}:/docs funkypenguin/mkdocs-material build -f mkdocs-insiders.yml diff --git a/scripts/build-pdf.sh b/scripts/build-pdf.sh new file mode 100755 index 0000000..a2b937a --- /dev/null +++ b/scripts/build-pdf.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +docker build --build-arg FROM_SOURCE=ghcr.io/geek-cookbook/mkdocs-material-insiders . -t funkypenguin/mkdocs-material --platform amd64 +docker run --rm --name mkdocs-material -e ENABLE_PDF_EXPORT=1 -v ${PWD}:/docs funkypenguin/mkdocs-material build -f mkdocs-pdf-print.yml