You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a password is defined in an article, it will **ALWAYS** overwrite the global password.
105
106
106
-
> **NOTE** Keep in mind that if the `password:` tag exists without value in an article, it will **not be protected** !
107
+
> **NOTE** Keep in mind that if the `password:` tag exists without value in a page, it will **not be protected** !
108
+
> Use this to **disable** `global_password` on specific pages.
107
109
108
110
109
111
### Secret from environment
@@ -128,7 +130,7 @@ plugins:
128
130
> However this can be converted into a warning by setting `ignore_missing_secret: true`.
129
131
> Use this only if you use a secret environment variable for production and a plain password for testing. You have been warned.
130
132
131
-
> **NEW** The meta tag `use_secret` can also be set to achieve the same functionality on page level.
133
+
> The meta tag `use_secret` can also be set to achieve the same functionality on page level.
132
134
133
135
### Default vars customization
134
136
@@ -140,8 +142,8 @@ plugins:
140
142
title_prefix: '[LOCK]'
141
143
summary: 'another informational message to encrypted content'
142
144
placeholder: 'another password placeholder'
143
-
decryption_failure_message: 'another informational message when decryption fail'
144
-
encryption_info_message: 'another information message when you dont have acess !'
145
+
decryption_failure_message: 'another informational message when decryption fails'
146
+
encryption_info_message: "another information message when you don't have access !"
145
147
input_class: 'md-search__form md-search__input'
146
148
button_class: 'md-search__icon'
147
149
```
@@ -158,7 +160,38 @@ Defaut encryption information message is `Contact your administrator for access
158
160
159
161
> **NOTE** Adding a prefix to the title does not change the default navigation path !
160
162
161
-
Use `input_class` and `button_class` to optionally set a CSS class for the password field and the button.
163
+
### Translations
164
+
165
+
If the plugin is used in conjunction with the [static-i18n](https://ultrabug.github.io/mkdocs-static-i18n/) plugin you can provide `translations` for the used `i18n_page_file_locale`.
166
+
167
+
```yaml
168
+
- encryptcontent:
169
+
#...
170
+
translations:
171
+
de:
172
+
title_prefix: '[Verschlüsselt] '
173
+
summary: 'Der Inhalt dieser Seite ist mit AES verschlüsselt. '
174
+
placeholder: 'Mit Strg+Enter wird das Passwort global gesetzt'
175
+
password_button_text: 'Entschlüsseln'
176
+
decryption_failure_message: 'Falsches passwort.'
177
+
encryption_info_message: 'Bitte wenden Sie sich an den Systemadministrator um auf diese Seite zuzugreifen.'
178
+
```
179
+
180
+
#### Custom per-page strings
181
+
182
+
You can set the meta tag `encryption_summary` to customize `summary` and `encryption_info_message` on every page.
183
+
184
+
### Obfuscate pages
185
+
186
+
If you want to make it harder for search engines to scrape you pages content,
187
+
you can set `obfuscate: SomeNotSoSecretPassword` meta tag in markdown.
188
+
189
+
The page than will display `summary` and `encryption_info_message` together with a button labeled with.
190
+
`password_button_text`. In order to view the pages content one hast to press the button first.
191
+
192
+
If a `password` or `use_secret` is set, then the `obfuscate` feature will be disabled.
193
+
If you want to use `obfuscate` in a configuration where `global_password` is defined,
194
+
you'll need to set `password:` meta tag (with no password defined) to undefine the password on this page.
162
195
163
196
# Features
164
197
@@ -258,7 +291,8 @@ the page will be automatically decrypted using the value previously created.
258
291
By default, the key is created with a name relative to the page on which it was generated.
259
292
This 'relative' key will always be used as first attempt to decrypt the current page when loading.
260
293
261
-
If your password is a [global password](#global-password-protection), you can fill in the form field `mkdocs-content-password`, then use the keyboard shortcut `CTRL + ENTER` instead of the classic `ENTER`.
294
+
If your password is a [global password](#global-password-protection), you can fill in the form
295
+
field `mkdocs-content-password`, then use the keyboard shortcut `CTRL + ENTER` instead of the classic `ENTER`.
262
296
The key that will be created with a generic name to making it accessible, by default, on all the pages of your site.
263
297
264
298
The form of decryption remains visible as long as the content has not been successfully decrypted, which allows in case of error to retry.
@@ -272,15 +306,16 @@ plugins:
272
306
default_expire_delay: 24 # <-- Default expire delay in hours (optional)
273
307
```
274
308
275
-
> **NOTE** The expired elements of the localStorage are only deleted by the execution of the decrypt-content.js scripts and therefore by the navigation on the site. Secret items can therefore remain visible in local storage after their expiration dates.
276
-
> Now The default is to use sessionStorage instead of localStorage, so the browser forgets the password after the current tab was closed. However it can be set to use localStorage by setting `session_storage: False`
309
+
> **NOTE** The expired elements of the localStorage are only deleted by the execution of the decrypt-content.js
310
+
> scripts and therefore by the navigation on the site. Secret items can therefore remain visible in local storage
311
+
> after their expiration dates.
312
+
> Now The default is to use sessionStorage instead of localStorage, so the browser forgets the password after
313
+
> the current tab was closed. However it can be set to use localStorage by setting `session_storage: False`
277
314
278
315
### Encrypt something
279
316
280
317
Related to [issue #9](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/9)
281
318
282
-
The [tag encrypted page feature](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin#tag-encrypted-page) **MUST** be enabled (it's default) for this feature to work properly.
283
-
284
319
Add `encrypted_something: {}` in the plugin configuration variable, to encrypt something else.
285
320
286
321
The syntax of this new variable **MUST** follow the yaml format of a dictionary.
@@ -332,7 +367,7 @@ plugins:
332
367
mkdocs-encrypted-toc: [div, id]
333
368
```
334
369
335
-
2. Other example, with multiples target. In you Material Theme, you want to encrypt ToC content and Footer.
370
+
2. Other example, with multiples target. In your custom Material theme, you want to encrypt ToC content and Footer.
336
371
337
372
Materiel generate 2 `<nav>` structure with the same template `toc.html`, so you need to use a `class` instead of an id for this part.
338
373
The footer part, is generated by the `footer.html` template in a classic div so an `id` is sufficient
@@ -351,7 +386,7 @@ After modification, your template looks like this :
351
386
</footer>
352
387
```
353
388
354
-
Your configuration like this :
389
+
Your configuration would look like this :
355
390
```yaml
356
391
plugins:
357
392
- encryptcontent:
@@ -361,7 +396,8 @@ plugins:
361
396
mkdocs-encrypted-footer-meta: [div, id]
362
397
```
363
398
364
-
3. If you are using mkdocs-material, then this example will also encrypt menu, toc and footer
399
+
3. If you are using unmodified mkdocs-material, then this example will encrypt menu, toc and footer
400
+
But you'd need the Navigation pruning feature to hide the title of encrypted pages from navigation (or see 2.).
365
401
366
402
```yaml
367
403
plugins:
@@ -396,6 +432,8 @@ plugins:
396
432
md-content: [div, class]
397
433
```
398
434
435
+
> This feature overrides the normal practice of replacing the rendered content of a page.
436
+
399
437
### Search index encryption
400
438
401
439
> **Default value is "encrypted"**
@@ -413,7 +451,7 @@ Three configuration modes are possible:
413
451
414
452
* **clear** : Search index is not encrypted. Search is possible even on protected pages.
415
453
* **dynamically** : Search index is encrypted on build. Search is possible once the pages have been decrypted.
416
-
* **encrypted** : Search index of encrypted pages is removed on build. Search is not possible on all encrypted pages.
454
+
* **encrypted** : Search index of encrypted pages is removed on build. Search is not possible on encrypted pages.
417
455
418
456
You can set `search_index: '<mode_name>'` in your `mkdocs.yml` to change the search index encryption mode. Possible values are `clear`, `dynamically`, `encrypted`. The default mode is "**encrypted**".
419
457
@@ -424,22 +462,28 @@ plugins:
424
462
```
425
463
426
464
This functionality modifies the search index created by the “search” plug-in.
427
-
Some themes might override the default “search” plug-in provided by mkdocs, but so far the structure of the `search/search_index.json` file is consistent.
465
+
Some themes might override the default search plug-in provided by mkdocs,
466
+
but so far the structure of the `search/search_index.json` file is consistent.
428
467
429
468
> The modification of the search index is carried out last (if `encryptcontent` is also last in `plugins`).
430
469
> But always double-check the generated index after `mkdocs build` to see if your information is protected.
431
470
432
-
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)
433
-
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.
471
+
When the configuration mode is set to "**dynamically**", the
are used to override the default search plugin files provided by MkDocs.
474
+
They include a process of decrypting and keeping the search index in a SessionStorage.
434
475
435
476
### Search index encryption for mkdocs-material
436
477
437
-
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) uses a different search plugin that cannot "easily" be overridden like the default search plugin.
438
-
However this Plugin will still remove encrypted pages (`encrypted`) or encrypt the search entries (`dynamically`) for `mkdocs-material`.
478
+
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) uses a different search plugin that
479
+
cannot "easily" be overridden like the default search plugin.
480
+
However this Plugin will still remove encrypted pages (`encrypted`) or encrypt the search entries (`dynamically`)
481
+
for `mkdocs-material`.
439
482
440
483
In order to be able to decrypt the search index (`dynamically`) `mkdocs-material` needs to be customized (patched).
441
484
442
-
You'll need some [prerequisites](https://squidfunk.github.io/mkdocs-material/customization/#environment-setup) and also execute these commands:
485
+
You'll need some [prerequisites](https://squidfunk.github.io/mkdocs-material/customization/#environment-setup)
Related to [issue #32](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/32)
463
507
464
-
You can override the default templates with your own templates by providing an actual replacement path in the `html_template_path` *(HTML)* and `js_template_path` *(JS)* directives. Overridden templates **completely** replace the default templates. You **must** therefore copy the default templates to keep this module working.
508
+
You can override the default templates with your own templates by providing an actual replacement
509
+
path in the `html_template_path` *(HTML)* and `js_template_path` *(JS)* directives.
510
+
Overridden templates **completely** replace the default templates. You **must** therefore copy the
When you overriding the default templates, you can add and use your own Jinja variables to condition and enrich your template, by defining `html_extra_vars` and `js_extra_vars` directives in key/value format. Added values can be used in your Jinja templates via the variable `extra`.
522
+
Use `input_class` and `button_class` to optionally set a CSS class for the password input field and the button.
523
+
524
+
When you overriding the default templates, you can add and use your own Jinja variables to condition
525
+
and enrich your template, by defining `html_extra_vars` and `js_extra_vars` directives in key/value format.
526
+
Added values can be used in your Jinja templates via the variable `extra`.
474
527
475
528
```yaml
476
529
plugins:
@@ -491,7 +544,9 @@ For example, you can modify your HTML template, to add a new title with your own
491
544
[ ... ]
492
545
```
493
546
494
-
> **NOTE** You must avoid replacing/overwriting the variables used by default by this module. The limitations are the same as those of the jinja models. Issues related to template override will not be addressed.
547
+
> **NOTE** You must avoid replacing/overwriting the variables used by default by this module.
548
+
> The limitations are the same as those of the jinja models.
549
+
> Issues related to template override will not be addressed.
495
550
496
551
### Add button
497
552
@@ -540,24 +595,6 @@ plugins:
540
595
selfhost_download: false
541
596
```
542
597
543
-
### Translations
544
-
545
-
If the plugin is used in conjunction with the [static-i18n](https://ultrabug.github.io/mkdocs-static-i18n/) plugin you can provide `translations` for the used `i18n_page_file_locale`.
546
-
547
-
```yaml
548
-
- encryptcontent:
549
-
#...
550
-
translations:
551
-
de:
552
-
title_prefix: '[Verschlüsselt] '
553
-
summary: 'Der Inhalt dieser Seite ist mit AES verschlüsselt. '
554
-
placeholder: 'Mit Strg+Enter wird das Passwort global gesetzt'
555
-
password_button_text: 'Entschlüsseln'
556
-
decryption_failure_message: 'Falsches passwort.'
557
-
encryption_info_message: 'Bitte wenden Sie sich an den Systemadministrator um auf diese Seite zuzugreifen.'
558
-
```
559
-
560
-
561
598
# Contributing
562
599
563
600
From reporting a bug to submitting a pull request: every contribution is appreciated and welcome.
0 commit comments