A fork of MkDocs plugin that encrypt/decrypt markdown content with AES
Project description
mkdocs-encryptcontent-plugin
This plugin allows you to have password protected articles and pages in MKdocs. The content is encrypted with AES-256 in Python using PyCryptodome, 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.
usecase
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.
Installation
Install the package with pip:
pip install mkdocs-encryptcontent-plugin
Install the package from source with pip:
cd mkdocs-encryptcontent-plugin/
python3 setup.py sdist bdist_wheel
pip3 install dist/mkdocs_encryptcontent_plugin-0.0.3-py3-none-any.whl
Enable the plugin in your mkdocs.yml
:
plugins:
- 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 thesearch
plugin. MkDocs enables it by default if there is noplugins
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
plugins:
- 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 !
Extra vars customization
Optionally you can add title_prefix
and summary
in plugin config variables to customize default messages.
plugins:
- search
- encryptcontent:
global_password: 'your_password'
title_prefix: '[LOCK]'
summary: 'another informational message than the default one'
Default prefix title is [Protected]
and default summary message is This content is protected with AES encryption.
NOTE Adding a prefix to the title does not change the default navigation path !
Features
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) => {
hljs.highlightBlock(block);
});
{% endif %}
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. If you want to contribute to the code of this project, please read the Contribution Guidelines.
Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mkdocs-encryptcontent-plugin-gw-0.0.3.2.tar.gz
.
File metadata
- Download URL: mkdocs-encryptcontent-plugin-gw-0.0.3.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b308d7687c060a83100477c9e2f40954173e3ee17e554b8c00a4a99883f37d5 |
|
MD5 | bc26261b665547d5f21c78e6ac0e18d6 |
|
BLAKE2b-256 | cb866067ded84156b7eea2c4d9ec87a80bc96cd91f23e82b4690f9a9f9f9fef7 |
File details
Details for the file mkdocs_encryptcontent_plugin_gw-0.0.3.2-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_encryptcontent_plugin_gw-0.0.3.2-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c2c6562800b16b816d7b5d0d10489c1d52623f7b91feda546073f741ce7eeb1 |
|
MD5 | 5a0b06afe3bc862e1346875100a70358 |
|
BLAKE2b-256 | 7339ac854ae503e6f3b3fd9a3cb843cf3ad8c2ae44fa5a7521cba47655d8cdde |