Skip to main content

An MkDocs plugin to export content pages to any files that pandoc can handle

Project description

Mkdoc Pandoc Plugin

This plugin is based on https://github.com/HaoLiuHust/mkdocs-mk2pdf-plugin and aims to use pandoc as a generic engine to convert to many document format that pandoc suports.

An MkDocs plugin to convert content pages to many format

The plugin will use pandoc to export all markdown pages in your MkDocs repository.

Requirements

  1. This package requires MkDocs version 1.0 or higher (0.17 works as well)
  2. Python 3.4 or higher
  3. pandoc, xelatex(to support Chinese)
    sudo apt install pandoc
    sudo apt install texlive texlive-latex-extra texlive-latex-recommended texlive-xetex
    

Installation

Install the package with pip:

pip install mkdocs-pandoc-plugin

Enable the plugin in your mkdocs.yml:

plugins:
    - search
    - pandoc

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

More information about plugins in the [MkDocs documentation][mkdocs-plugins].

Testing

When building your repository with mkdocs build, you should now see the following message at the end of your build output:

Converting 17 files to PDF took 15.6s

In your site_dir you should now have a PDF file for every markdown page.

Options

You may customize the plugin by passing options in mkdocs.yml:

plugins:
    - pandoc:
        enabled_if_env: ENABLE_PANDOC_EXPORT

enabled_if_env

Setting this option will enable the build only if there is an environment variable set to 1. This is useful to disable building the files during development, since it can take a long time to export all files. Default is not set.

combined

Setting this to true will combine all pages into a single file. All download links will point to this file. Default is false.

combined_output_path

This option allows you to use a different destination for the combined file. Has no effect when combined is set to false. Default is pandoc/combined.pdf.

pandoc_template

This option allows you to use a custom pandoc template to convert markdown file to translated document files.

mkdocs.yml:

plugins:
    - pandoc:
project-root
├── docs
├── mkdocs.yml
├── site
.
.

Contributing

From reporting a bug to submitting a pull request: every contribution is appreciated and welcome. Report bugs, ask questions and request features using [Github issues][github-issues]. If you want to contribute to the code of this project, please read the [Contribution Guidelines][contributing].

Special thanks

Special thanks go to HaoLiuHust for developing the mkdocs-mk2pdf-plugin.

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-pandoc-plugin-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

mkdocs_pandoc_plugin-1.0.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-pandoc-plugin-1.0.0.tar.gz.

File metadata

  • Download URL: mkdocs-pandoc-plugin-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for mkdocs-pandoc-plugin-1.0.0.tar.gz
Algorithm Hash digest
SHA256 48e426ea2a4472df3f6058436d5ae9b36afd617bdef3fe213f753f51d2b99bcd
MD5 3e4863d971ac0c604cc5f22335e84fe8
BLAKE2b-256 e84d50ee405f6b1b524c877238b077669ff2cbc5ab561018b55f6e2025ef8e34

See more details on using hashes here.

File details

Details for the file mkdocs_pandoc_plugin-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_pandoc_plugin-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for mkdocs_pandoc_plugin-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e346c7e67a35cdf2bf73e48353e04a31e39f1a27ad8bff27b8fb49680804bbb3
MD5 cff3839a7967c6fe0956d42cca0a80ac
BLAKE2b-256 326eb7203ab299d71630988fd2fe63c20935bdc197f231ddd9f8dd57f4b4eb37

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