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:** If you have no `plugins` entry in your configuration 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.
64
+
> **NOTE:** If you have no `plugins` entry in your configuration 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.
64
65
65
66
# Usage
66
67
@@ -76,9 +77,9 @@ plugins:
76
77
global_password: 'your_password'
77
78
```
78
79
79
-
If a password is defined in an article, it will ALWAYS overwrite the global password.
80
+
If a password is defined in an article, it will **ALWAYS** overwrite the global password.
80
81
81
-
> **NOTE** Keep in mind that if the `password:` tag exists without value in an article, it will not be protected !
82
+
> **NOTE** Keep in mind that if the `password:` tag exists without value in an article, it will **not be protected** !
82
83
83
84
### Extra vars customization
84
85
@@ -113,7 +114,7 @@ Defaut encryption information message is `Contact your administrator for access
113
114
114
115
> **Enable by default**
115
116
116
-
If HighlightJS module is detected in your theme to improve code color rendering, reload renderer after decryption process. If HighlightJS module is not correctly detected, you can force it by adding `hljs: True` on the plugin configuration or set False to disable detection.
117
+
If HighlightJS module is detected in your theme to improve code color rendering, reload renderer after decryption process. If HighlightJS module is not correctly detected, you can force the detection by adding `hljs: True` on the plugin configuration or set `hljs: False` to disable this feature.
117
118
118
119
When enable the following part of the template is add to force reloading decrypted content.
Related to [issue #12](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/12)
133
134
134
-
If Arithmatex markdown extension is detected in your markdown extensions to improve math equations rendering, reload renderer after decryption process. If the Arithmatex markdown extension is not correctly detected, you can force it by adding `arithmatex: True` on the plugin configuration or set False to disable detection.
135
+
If Arithmatex markdown extension is detected in your markdown extensions to improve math equations rendering, reload renderer after decryption process. If the Arithmatex markdown extension is not correctly detected, you can force the detection by adding `arithmatex: True` on the plugin configuration or set `arithmatex: False` to disable this feature.
135
136
136
137
When enable, the following part of the template is add to force math equations rendering on decrypted content.
137
138
@@ -147,17 +148,11 @@ When enable, the following part of the template is add to force math equations r
147
148
148
149
Related to [issue #7](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/7)
149
150
150
-
You can add `tag_encrypted_page: False` in plugin configuration, to disable tagging of encrypted pages. This feature is neccessary for others feature working correctly. If you disable this feature, do no use [Encrypt Somethings](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin#encrypt-something),
151
-
152
151
This feature add an additional attribute `encrypted` with value `True` to the mkdocs type `mkdocs.nav.page` object.
153
152
154
-
```yaml
155
-
plugins:
156
-
- encryptcontent:
157
-
tag_encrypted_page: False
158
-
```
153
+
You can add `tag_encrypted_page: False` in plugin configuration, to disable tagging of encrypted pages. **BUT** This feature is neccessary for others feature working correctly. If you disable this feature, do no use [Encrypt Somethings](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin#encrypt-something),
159
154
160
-
It becomes possible to use this attribute in the jinja template of your theme, as a condition to perform custom modification.
155
+
When enable, it becomes possible to use `encrypted` attribute in the jinja template of your theme, as a condition to perform custom modification.
161
156
162
157
```jinja
163
158
{%- for nav_item in nav %}
@@ -177,53 +172,35 @@ For example, in your template, you can use conditional check to add custom class
177
172
178
173
Related to [issue #6](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/6)
179
174
180
-
> :warning: **This feature is not really secure !** Password are store in clear text inside local cookie without httpOnly flag.
175
+
> :warning: **This feature is not really secure !** Password are store in clear text inside local storage.
181
176
>
182
177
> Instead of using this feature, I recommend to use a password manager with its web plugins.
183
178
> For example **KeepassXC** allows you, with a simple keyboard shortcut, to detect the password field `mkdocs-content-password` and to fill it automatically in a much more secure way.
184
179
185
180
If you do not have password manager, you can set `remember_password: True` in your `mkdocs.yml` to enable password remember feature.
186
181
187
-
When enabled, each time you fill password form and press `Enter` a cookie is create with your password as value.
188
-
When you reload the page, if you already have an 'encryptcontent' cookie in your browser,
189
-
the page will be automatically decrypted using the value of the cookie.
190
-
191
-
By default, the cookie is created with a `path=` relative to the page on which it was generated.
192
-
This 'specific' cookie will always be used as first attempt to decrypt the current page when loading.
182
+
When enabled, each time you fill password form and press `Enter` a key on local storage is create with your password
183
+
as value. When you reload the page, if you already have an 'encryptcontent' key in the local storage of your browser,
184
+
the page will be automatically decrypted using the value previously created.
193
185
194
-
If your password is a global password, you can fill in the `mkdocs-content-password` field,
195
-
then use the keyboard shortcut `CTRL + ENTER` instead of the classic `ENTER`.
196
-
The cookie that will be created with a `path=/` making it accessible, by default, on all the pages of your site.
186
+
By default, the key is created with a name relative to the page on which it was generated.
187
+
This 'relative' key will always be used as first attempt to decrypt the current page when loading.
197
188
198
-
The form of decryption remains visible as long as the content has not been successfully decrypted,
199
-
which allows in case of error to modify the created cookie.
189
+
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`.
190
+
The key that will be created with a generic name to making it accessible, by default, on all the pages of your site.
200
191
201
-
All cookies created with this feature have the default security options `Secure` and `SameSite=Strict`, just cause ...
192
+
The form of decryption remains visible as long as the content has not been successfully decrypted, which allows in case of error to retry.
193
+
All keys created with this feature on localstorage have an default expire time daly set to 24 hours, just cause ...
202
194
203
-
However *(optionally)*, its possible to remove these two security options by adding `disable_cookie_protection: True` in your `mkdocs.yml`.
204
-
205
-
Your configuration should look like this when you enabled this feature :
195
+
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 :
206
196
```yaml
207
197
plugins:
208
198
- encryptcontent:
209
199
remember_password: True
210
-
disable_cookie_protection: True # <-- Really a bad idea
200
+
default_expire_dalay: 24 # <-- Default expire delay in hours (optional)
211
201
```
212
202
213
-
### Add button
214
-
215
-
Add `password_button: True` in plugin configuration variable, to add button to the right of the password field.
216
-
217
-
When enable, it allows to decrypt the content without creating a cookie *(if remember password feature is activated)*
218
-
219
-
Optionnally, you can add `password_button_text: 'custome_text_button'` to customize the button text.
220
-
221
-
```yaml
222
-
plugins:
223
-
- encryptcontent:
224
-
password_button: True
225
-
password_button_text: 'custome_text_button'
226
-
```
203
+
> **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.
227
204
228
205
### Encrypt something
229
206
@@ -252,7 +229,7 @@ Prefer to use an `'id'`, however depending on the template of your theme, it is
252
229
So we can use the class attribute to define your unique name inside html tag.
253
230
BeautifulSoup will encrypt all HTML elements discovered with the class.
254
231
255
-
When the feature is enabled, you can use any methods *(password, button, cookie)* to decrypt every elements encrypted on the page.
232
+
When the feature is enabled, you can use any methods *(password, button, remember)* to decrypt every elements encrypted on the page.
256
233
257
234
By default **every child items** are encrypted and the encrypted elements have `style=display:none` to hide their content.
258
235
@@ -311,10 +288,9 @@ plugins:
311
288
mkdocs-encrypted-footer-meta: [div, id]
312
289
```
313
290
314
-
315
291
### Search index encryption
316
292
317
-
> **ALPHA VERSION**, use at your own risks. **ONLY** work with themes using default mkdocs search.
293
+
> **Default value is "encrypted"**
318
294
319
295
Related to [issue #13](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/13)
320
296
@@ -335,15 +311,30 @@ You can set `search_index: '<mode_name>'` in your `mkdocs.yml` to change the sea
335
311
336
312
```yaml
337
313
plugins:
338
-
- search:
339
314
- encryptcontent:
340
315
search_index: 'dynamically'
341
316
```
342
317
343
-
This functionality overwrite the index creation function of the “search” plug-in provided by mkdocs. The modifications carried out make it possible to encrypt the content of the search index *after* the default plugin has carried out these treatments *(search configuration)*. It is therefore dependent on the default search plugin.
318
+
This functionality overwrite the index creation function of the “search” plug-in provided by mkdocs. The modifications carried out make it possible to encrypt the content of the search index *after* the default plugin has carried out these treatments *(search configuration)*. It is therefore dependent on the default search plugin.
344
319
345
-
When the configuration mode is set to "**dynamically**", the javascripts contrib files of the default search plugin are also overloaded to include a process for decrypting and keeping the search index.
320
+
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) 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.
346
321
322
+
> **NOTE** The mode 'dynamically' is currently **not compatible with Material Theme** !
323
+
324
+
### Add button
325
+
326
+
Add `password_button: True` in plugin configuration variable, to add button to the right of the password field.
327
+
328
+
When enable, it allows to decrypt the content just like the classic keypress ENTER. If remember password feature is activated, use button to decrypt generate a 'relative' key on your local storage. You cannot use password button to create global password value.
329
+
330
+
Optionnally, you can add `password_button_text: 'custom_text_button'` to customize the button text.
0 commit comments