Skip to main content

A MkDocs plugin that encrypt/decrypt markdown content with AES

Project description


This plugin allows you to have password protected articles and pages in MKdocs. The content is encrypted with AES-256 in Python using PyCrypto, and decrypted in the browser with Crypto-JS. It has been tested in Python 2.7 and Python 3.5.

An mkdocs version of the plugin Encrypt content for Pelican.


I want to be able to protect my articles with password. And I would like this protection to be as granular as possible.
It is possible to define a password to protect each article independently or a global password to encrypt all of them.
If a global password exists, all articles and pages except the homepage are encrypted with this password.
If a password is defined in an article or a page, it is always used even if a global password exists.
If a password is defined as an empty character string, the page is not encrypted.


Install the package with pip:

pip install mkdocs-encryptcontent-plugin

Install the package from source with pip:

cd mkdocs-encryptcontent-plugin/
python3 sdist bdist_wheel
pip3 install dist/mkdocs_encryptcontent_plugin-0.0.2-py3-none-any.whl

Enable the plugin in your mkdocs.yml:

    - search
    - encryptcontent: {}

You are then able to use the meta tag password: secret_password in your markdown files to protect them.

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.

Using global password protection

Add global_password: your_password in plugin config variable, to protect by default your articles with this password

    - search
    - encryptcontent:
        global_password: 'your_password'

If a password is defined in an article, it will ALWAYS overwrite the global password.

NOTE Keep in mind that if the password: tag exists without value in an article, it will not be protected !


HighlightJS support

If your theme use HighlightJS module to improve color, and highlightjs: true is set in your mkdocs.yml, this plugin enable this part of the jinja template to force reload heiglighting in decrypted content.

{% if hljs %}
document.getElementById("mkdocs-decrypted-content").querySelectorAll('pre code').forEach((block) => {
{% endif %}


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. If you want to contribute to the code of this project, please read the Contribution Guidelines.


Project details

Download files

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

Files for mkdocs-encryptcontent-plugin, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size mkdocs_encryptcontent_plugin-0.0.2-py3-none-any.whl (7.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size mkdocs-encryptcontent-plugin-0.0.2.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page