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
You are then able to use the meta tag `password: secret_password` in your markdown files to protect them.
64
+
> **Note:** If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin.
65
+
> MkDocs enables it by default if there is no `plugins` entry set, but now you have to enable it explicitly.
46
66
47
-
> **Note:** If you have no `plugins` entry in your config 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.
48
67
68
+
# Usage
49
69
50
-
### Using global password protection
70
+
Add an meta tag `password: secret_password` in your markdown files to protect the
71
+
72
+
### Global password protection
51
73
52
74
Add `global_password: your_password` in plugin config variable, to protect by default your articles with this password
53
75
@@ -57,7 +79,7 @@ plugins:
57
79
global_password: 'your_password'
58
80
```
59
81
60
-
If a password is defined in an article, it will ALWAYS overwrite the global password.
82
+
If a password is defined in an article, it will **ALWAYS** overwrite the global password.
61
83
62
84
> **NOTE** Keep in mind that if the `password:` tag exists without value in an article, it will not be protected !
63
85
@@ -75,25 +97,28 @@ plugins:
75
97
encryption_info_message: 'another information message when you dont have acess !'
76
98
```
77
99
78
-
Default prefix title is `[Protected]`
100
+
Default prefix title is `[Protected]`.
79
101
80
-
Default summary message is `This content is protected with AES encryption.`
102
+
Default summary message is `This content is protected with AES encryption.`.
81
103
82
-
Default password palceholder is `Provide password and press ENTER`
104
+
Default password palceholder is `Provide password and press ENTER`.
83
105
84
-
Default decryption failure message is `Invalid password.`
106
+
Default decryption failure message is `Invalid password.`.
85
107
86
-
Defaut encryption information message is `Contact your administrator for access to this page.`
108
+
Defaut encryption information message is `Contact your administrator for access to this page.`.
87
109
88
110
> **NOTE** Adding a prefix to the title does not change the default navigation path !
89
111
90
112
91
-
## Features
113
+
# Features
92
114
93
115
### HighlightJS support
94
116
95
-
If your theme use HighlightJS module to improve color, set `highlightjs: true` in your `mkdocs.yml`, to enable color reloading after decryption process.
96
-
117
+
> **Enable by default**
118
+
119
+
If HighlightJS module is detected in your theme, reload colors renderer after decryption process.
120
+
If HighlightJS module is not correctly detected, you can force it by adding `hljs: True` on the plugin configuration or set `hljs: False` to disable this feature.
121
+
97
122
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)
110
137
111
-
If Arithmatex markdown extension is set in your markdown extensions to improve math equations rendering, reload rendering after decryption process.
112
-
138
+
If Arithmatex markdown extension is detected in your markdown extensions, reload math equation rendering after decryption process.
139
+
If Arithmatex markdown extension is not correctly detected, you can force it by adding `arithmatex: True` on the plugin configuration or set `arithmatex: False` to disable this feature.
140
+
113
141
When enable the following part of the template is add to force math equations rendering on decrypted content.
114
142
115
143
```jinja
116
-
{% if arithmatex %}MathJax.typesetPromise(){% endif %}
144
+
{% if arithmatex %}
145
+
MathJax.typesetPromise()
146
+
{% endif %}
117
147
```
118
148
119
149
> **NOTE** It has been tested in Arithmatex `generic` mode only.
120
150
121
151
### Tag encrypted page
122
152
153
+
> **Enable by default**
154
+
123
155
Related to [issue #7](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/7)
124
156
125
-
You can add `tag_encrypted_page: True` in plugin config variable, to enable tagging of encrypted pages.
157
+
This feature add an additional attribute `encrypted` with value `True` to the mkdocs type `mkdocs.nav.page` object.
126
158
127
-
When this feature is enabled, an additional attribute `encrypted` with value `True,` is added to the mkdocs type `mkdocs.nav.page` object.
159
+
You can add `tag_encrypted_page: False` in plugin configuration, to disable tagging of encrypted pages.
160
+
This feature is neccessary for others feature working correctly.
128
161
129
-
```yaml
130
-
plugins:
131
-
- encryptcontent:
132
-
tag_encrypted_page: True
133
-
```
162
+
If you disable this feature, **do no use** [Encrypt Somethings](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin#encrypt-something),
134
163
135
-
It becomes possible to use this attribute in the jinja template of your theme, as a condition to perform custom modification.
164
+
When enable, it becomes possible to use `encrypted` attribute in the jinja template of your theme, as a condition to perform custom modification.
136
165
137
166
```jinja
138
167
{%- for nav_item in nav %}
@@ -142,12 +171,25 @@ It becomes possible to use this attribute in the jinja template of your theme, a
142
171
{%- endfor %}
143
172
```
144
173
145
-
For example, in your template, you can use conditional check to add custom class :
174
+
For example, in your theme template, you can use conditional check to add custom class :
Add `password_button: True` in plugin config variable, to add button to the right of the password field decrypt the content.
183
+
184
+
Optionnally, you can add `password_button_text: 'custome_text_button'` to customize the button text.
185
+
186
+
```yaml
187
+
plugins:
188
+
- encryptcontent:
189
+
password_button: True
190
+
password_button_text: 'custome_text_button'
191
+
```
192
+
151
193
### Rebember password
152
194
153
195
Related to [issue #6](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/6)
@@ -182,30 +224,14 @@ Your configuration should look like this when you enabled this feature :
182
224
plugins:
183
225
- encryptcontent:
184
226
remember_password: True
185
-
disable_cookie_protection: True # <-- Really a bad idea
227
+
disable_cookie_protection: True # <-- Really a bad idea (Dev mode)
186
228
```
187
229
188
-
### Add button
189
-
190
-
Add `password_button: True` in plugin config variable, to add button to the right of the password field.
191
-
192
-
When enable, it allows to decrypt the content without creating a cookie *(if remember password feature is activated)*
193
-
194
-
Optionnally, you can add `password_button_text: 'custome_text_button'` to customize the button text.
195
-
196
-
```yaml
197
-
plugins:
198
-
- encryptcontent:
199
-
password_button: True
200
-
password_button_text: 'custome_text_button'
201
-
```
202
-
203
-
204
230
### Encrypt Something
205
231
206
232
Related to [issue #9](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin/issues/9)
207
233
208
-
You **have to** enable [feature tag encrypt page](https://github.com/CoinK0in/mkdocs-encryptcontent-plugin#tag-encrypted-page) for this feature to work properly.
234
+
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.
209
235
210
236
Add `encrypted_something: {}` in the plugin configuration variable, to encrypt something else.
211
237
@@ -232,7 +258,7 @@ When the feature is enabled, you can use any methods *(password, button, cookie)
232
258
233
259
By default **every child items** are encrypted and the encrypted elements have `style=display:none` to hide their content.
234
260
235
-
#### How to use it :exploding_head: ?! Examples
261
+
#### How to use it :exploding_head: ?! Examples
236
262
237
263
Use the `page.encrypted` conditions to add attributes of type id or class in the HTML templates of your theme.
238
264
Each attribute is identified with a unique name and is contained in an html element.
@@ -334,7 +360,7 @@ var reload_js = function(src) {
334
360
```
335
361
336
362
337
-
## Contributing
363
+
# Contributing
338
364
339
365
From reporting a bug to submitting a pull request: every contribution is appreciated and welcome.
340
366
@@ -345,5 +371,3 @@ If you want to contribute to the code of this project, please read the [Contribu
0 commit comments