Sign inSign up

soluxioni/mkdocs-material-pdf-export

By soluxioni

•Updated about 4 years ago

MkDocs with Material theme and PDF export plugin

Image
0

240

soluxioni/mkdocs-material-pdf-export repository overview

A Docker image with MkDocs (https://www.mkdocs.org⁠) intended to be used with CI/CD tools (drone.io in our particular case) to generate documentation websites from MarkDown source files.

The image comes with MkDocs (default templates and MarkDown extensions) installed with Python 3 on Linux. As additional options, the following packages are also installed:

  • mkdocs-pdf-export-plugin with WeasyPrint and all it's dependencies, to allow PDF export
  • mkdocs-material for Material theme
  • mkdocs-minify-plugin
  • mkdocs-redirects

To enable PDF export, in the mkdocs.yml add:

plugins:
    - pdf-export:
        media_type: print
        theme_handler: pdf_export.py

The theme_handler is ONLY needed if you don't use the theme material, in which case you will need to provide a pdf_export.py handler. See https://github.com/zhaoterryy/mkdocs-pdf-export-plugin/#theme_handler_path⁠ for more information.

More info on MkDocs at https://www.mkdocs.org⁠.

An example of usage for MkDocs local development (run from project folder):

docker run --rm -it -p 8000:8000 -v ${PWD}:/docs soluxioni/mkdocs-material-pdf-export

An example of .drone.yml pipeline configuration for CI/CD build and deploy:

kind: pipeline
name: default

steps:
  - name: Build docs
    image: soluxioni/mkdocs-material-pdf-export
    volumes:
    - name: docs
      path: /docs
    commands:
      - mkdocs build
    when:
      branch:
        - master
      event:
        - push
  - name: Deploy docs
    image: drillster/drone-rsync
    settings:
      hosts: ["your.web.host.com"]
      user: root
      key:
        from_secret: example_private_key
      source: /drone/src/doc-project-folder/site/
      target: /var/www/doc-website/
    when:
      branch:
        - master
      event:
        - push

volumes:
- name: docs
  host:
    path: /docs-project-folder

More info on Drone.io at https://docs.drone.io/⁠.

Tag summary

Content type

Image

Digest

sha256:a85801d7d…

Size

384.6 MB

Last updated

about 4 years ago

docker pull soluxioni/mkdocs-material-pdf-export