Skip to content

Commit 9751a23

Browse files
committed
update README
1 parent 99e35ca commit 9751a23

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

README.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ The content is encrypted with AES-256 in Python using PyCryptodome, and decrypte
3939
* [Tag encrypted page](#tag-encrypted-page) *(default)*
4040
* [Remember password](#remember-password)
4141
* [Encrypt something](#encrypt-something)
42+
* [Inject decrypt-form.tpl to theme](#inject-decrypt-formtpl-to-theme) **(NEW)**
4243
* [Search index encryption](#search-index-encryption)
44+
* [Search index encryption for mkdocs-material](#search-index-encryption-for-mkdocs-material) **(NEW)**
4345
* [Override default templates](#override-default-templates)
4446
* [Add button](#add-button)
4547
* [Reload scripts](#reload-scripts)
48+
* [Self-host crypto-js](#self-host-crypto-js) **(NEW)**
4649
* [Contributing](#contributing)
4750

4851

@@ -350,7 +353,7 @@ plugins:
350353
md-nav: [nav, class]
351354
```
352355

353-
### Inject decrypt-form.tpl to theme (experimental)
356+
### Inject decrypt-form.tpl to theme
354357

355358
Some themes or plugins might interfere with the way this plugin encrypts the content of a page.
356359
In this case this feature will find and encrypt a unique tag in the same way as `encrypted_something`
@@ -408,10 +411,31 @@ Some themes might override the default “search” plug-in provided by mkdocs,
408411
> The modification of the search index is carried out last (if `encryptcontent` is also last in `plugins`).
409412
> But always double-check the generated index after `mkdocs build` to see if your information is protected.
410413

411-
When the configuration mode is set to "**dynamically**", the [javascripts contribution files](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/tree/experimental/encryptcontent/contrib/templates/search)
414+
When the configuration mode is set to "**dynamically**", the [javascripts contribution files](https://github.com/unverbuggt/mkdocs-encryptcontent-plugin/tree/master/encryptcontent/contrib/templates/search)
412415
are used to override the default search plugin files provided by MKdocs. They include a process of decrypting and keeping the search index in a SessionStorage.
413416

414-
> **NOTE** The mode 'dynamically' is currently **not compatible with Material Theme** !
417+
### Search index encryption for mkdocs-material
418+
419+
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) uses a different search plugin that cannot "easily" be overridden like the default search plugin.
420+
However this Plugin will still remove encrypted pages (`encrypted`) or encrypt the search entries (`dynamically`) for `mkdocs-material`.
421+
422+
In order to be able to decrypt the search index (`dynamically`) `mkdocs-material` needs to be customized (patched).
423+
424+
You'll need some [prerequisites](https://squidfunk.github.io/mkdocs-material/customization/#environment-setup) and also execute these commands:
425+
426+
```
427+
git clone https://github.com/squidfunk/mkdocs-material
428+
cd mkdocs-material
429+
pip install mkdocs-minify-plugin
430+
pip install mkdocs-redirects
431+
npm install
432+
433+
#copy material_search_worker.patch to mkdocs-material
434+
patch -p 0 < material_search_worker.patch
435+
436+
pip install --force-reinstall .
437+
#pip install --force-reinstall --no-deps . #faster if mkdocs-material was already installed
438+
```
415439
416440
### Override default templates
417441
@@ -472,8 +496,9 @@ You can set `reload_scripts:` in your `mkdocs.yml` with list of script source, t
472496

473497
```yaml
474498
plugins:
475-
reload_scripts:
476-
- "./js/example.js"
499+
- encryptcontent:
500+
reload_scripts:
501+
- "./js/example.js"
477502
```
478503

479504
This feature use the following JQuery function to remove, add and reload javascripts.
@@ -485,6 +510,22 @@ var reload_js = function(src) {
485510
};
486511
```
487512

513+
### Self-host crypto-js
514+
515+
If you enable `selfhost` then you'll choose to upload crypto-js to your web server rather than using cloudflare CDN.
516+
517+
Additionally if you set `selfhost_download` then the required files will be downloaded **every time** on `mkdocs serve` or `mkdocs build`.
518+
Be aware that this costs additional build time and it is better to copy the files from `site/assets/javascripts/cryptojs/*` to `docs/assets/javascripts/cryptojs/*` to speed things up.
519+
520+
```yaml
521+
plugins:
522+
- encryptcontent:
523+
selfhost: true
524+
selfhost_download: false
525+
```
526+
527+
528+
488529
# Contributing
489530

490531
From reporting a bug to submitting a pull request: every contribution is appreciated and welcome.

0 commit comments

Comments
 (0)