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
> **NOTE** Keep in mind that if the `use_secret:` configuration is set, it will always be used even if you have also set a global password with the `global_password` variable.
112
113
113
114
114
-
### Extra vars customization
115
+
### Default vars customization
115
116
116
117
Optionally you can use some extra variables in plugin configuration to customize default messages.
117
118
@@ -218,7 +219,7 @@ For example, in your theme template, you can use conditional check to add custom
Related to [issue #6](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/6)
224
225
@@ -240,14 +241,14 @@ If your password is a [global password](#global-password-protection), you can fi
240
241
The key that will be created with a generic name to making it accessible, by default, on all the pages of your site.
241
242
242
243
The form of decryption remains visible as long as the content has not been successfully decrypted, which allows in case of error to retry.
243
-
All keys created with this feature on localstorage have an default expire time daly set to 24 hours, just cause ...
244
+
All keys created with this feature on sessionStorage/localStorage have an default expire time daly set to 24 hours, just cause ...
244
245
245
-
However *(optionally)*, its possible to change the default expire time by setting options `default_expire_dalay: <number>` in your `mkdocs.yml`. Your configuration should look like this when you enabled this feature :
246
+
However *(optionally)*, its possible to change the default expire time by setting options `default_expire_delay: <number>` in your `mkdocs.yml`. Your configuration should look like this when you enabled this feature :
246
247
```yaml
247
248
plugins:
248
249
- encryptcontent:
249
250
remember_password: True
250
-
default_expire_dalay: 24 # <-- Default expire delay in hours (optional)
251
+
default_expire_delay: 24 # <-- Default expire delay in hours (optional)
251
252
```
252
253
253
254
> **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.
@@ -371,6 +372,42 @@ When the configuration mode is set to "**dynamically**", the [javascripts contri
371
372
372
373
> **NOTE** The mode 'dynamically' is currently **not compatible with Material Theme** !
373
374
375
+
### Override default templates
376
+
377
+
Related to [issue #32](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/32)
378
+
379
+
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.
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`.
389
+
390
+
```yaml
391
+
plugins:
392
+
- encryptcontent:
393
+
html_extra_vars:
394
+
my_extra: "extra value"
395
+
<key>: <value>
396
+
js_extra_vars:
397
+
my_extra: "extra value"
398
+
<key>: <value>
399
+
```
400
+
401
+
For example, you can modify your HTML template, to add a new title with your own text variable.
402
+
403
+
```jinja
404
+
[ ... ]
405
+
<h2>{{ extra.my_extra }}</h2>
406
+
[ ... ]
407
+
```
408
+
409
+
> **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.
410
+
374
411
### Add button
375
412
376
413
Add `password_button: True` in plugin configuration variable, to add button to the right of the password field.
0 commit comments