Skip to main content

A MkDocs plugin transforming annexes files into images to be integrated in markdown pages

Project description

mkdocs-annexes-integration

This is a plugin that transforms annex files into images to be integrated in Markdown pages for MkDocs.

Setup

Before installing

Before installing this plugin you need to install poppler-utils as it is used by pdf2image that is required to use this plugin.

Install on Linux :

Note: It depend on your Linux OS

sudo apt-get install poppler-utils
sudo yum install poppler-utils

Install on MacOS :

brew install poppler

Install on Windows :

On Windows, you can download the latest binary release of Poppler from the official website and extract the files to a folder. Then, add the folder to the system's PATH environment variable.

Installing using pip:

pip install mkdocs-annexes-integration

Config

You need to activate the plugin in mkdocs.yml:

plugins:
  - annexes-integration:
      annexes: # Required (at least 1)
        - Title of the annex A1: path/A/to/an/annex1.pdf # A path to an annex with it's title
        - Title of the annex A2: path/A/to/an/annex2.pdf # Another path to an annex in same folder as the first
        - Title of the annex B1: path/B/to/an/annex1.pdf # Another path to an annex but in different folder as the first two
        - Title of the annex:
            src: ../src/path/to/an/annex/file1.py
            dest: dest/path/to/an/annex/file1.py
        # others annexes...
      temp_dir: "folder_name" # Optional --> Default : temp_annexes
      enabled_if_env: ENABLE_PDF_EXPORT # Optional
      placeholders_when_disabled: true # Optional --> Default : false

As you can see, there are two possible ways to integrate an annex: using a simple path or a source path and a destination path. Both paths need to be relative to docs_dir, though.

Set at least one annex to use this plugin. If you don't have any annex don't add this plugin to the mkdocs plugins list in config file mkdocs.yml

  • annexes - A list of all the annexes documents. The path from docs_dir to an annex file associated to it's title
  • temp_dir - The temp directory used to generate markdown file for each annex before rendering to HTML. Only set this option if you already have a temp_annexes folder in the root directory (same as mkdocs.yml), which, you should not normally.
  • enabled_if_env - Setting this option will enable the build only if there is an environment variable set to 1. Integrations of PDF can slow down build process and it's pretty useful to be fast when doing modification to mkdocs files when doing mkdocs serve.
  • placeholders_when_disabled - This option will generate an mock file at the place of the integrated file to prevent warning from unreferenced link to the page by other pages. It is intended to be used with enabled_if_env.

Usage

Using the command mkdocs build or mkdocs serve will trigger the plugin if it as been set correctly in config file.

This plugin is intended to be used with mkdocs-with-pdf plugin but can be used as it is.

It is also strongly recommended to use it with mkdocs-material plugin. Using this plugin without mkdocs-material may result in unecessary page break between annex title and annex images.

Support

This plugin currently support PDF files :

  • PDF files: The plugin will convert each page of the PDF into images to be integrated on a page

License

This project is under MIT license see: license file for more detail.

See Also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-annexes-integration-0.1.7.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file mkdocs-annexes-integration-0.1.7.tar.gz.

File metadata

File hashes

Hashes for mkdocs-annexes-integration-0.1.7.tar.gz
Algorithm Hash digest
SHA256 ecf541f754825a9d2f76b896be96324e102913d1e507d92742ab88e108bd1517
MD5 8a375cebc25bd92d71a749dbc30bcc13
BLAKE2b-256 61925aa1ca72566f11c3b6469e916cd9aeff09dba46fa3f12567f46cbf60334e

See more details on using hashes here.

File details

Details for the file mkdocs_annexes_integration-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_annexes_integration-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a05eba6428a05ba890e15325c006f5778cd04cda381da9a4d5967720ce906678
MD5 a852520ea39400f928f318e3063c0751
BLAKE2b-256 6b3fc2f513364a8ec0527407e2f4be15fd79d43f62a8bdaac99d4e92a4156852

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page