Skip to content

Commit 2bbeea0

Browse files
committed
Use pymdownx.highlight instead of the deprecated codehilite
Signed-off-by: DL6ER <[email protected]>
1 parent 24e01c7 commit 2bbeea0

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

docs/api/auth.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ Result:
9797
"challenge": "a2926b025bcc8618c632f81cd6cf7c37ee051c08aab74b565fd5126350fcd056",
9898
"session":
9999
{
100-
"valid": false,
101-
"sid": null,
102-
"validity": null
100+
"valid": false,
101+
"sid": null,
102+
"validity": null
103103
}
104104
}
105105
```
@@ -111,7 +111,7 @@ Below, we provide concrete examples of how to authenticate with the Pi-hole API.
111111

112112
### Bash
113113

114-
``` bash
114+
``` bash linenums="1"
115115
computePWhash() {
116116
local password hash1 hash2
117117
password="${1}"
@@ -129,7 +129,7 @@ computeResponse() {
129129
}
130130
```
131131

132-
``` bash
132+
``` bash linenums="1" hl_lines="4 5 6"
133133
password="ABC"
134134
pwhash="$(computePWhash "$password")"
135135

@@ -145,7 +145,7 @@ sid="$(jq --raw-output .session.sid <<< "${session}")"
145145

146146
We recommend using [`geraintluff/sha256`](https://github.com/geraintluff/sha256) providing a small (less than 1 KB) SHA-256 implementation.
147147

148-
``` javascript
148+
``` javascript linenums="1" hl_lines="4 8 16"
149149
function getPWhash(password) {
150150
// Compute password hash twice to mitigate rainbow
151151
// table vulnerability
@@ -180,22 +180,25 @@ function doLogin(pwhash) {
180180
}
181181
});
182182
}
183+
```
183184

185+
``` javascript linenums="1"
184186
var password = "ABC";
185187
var pwhash = getPWhash("ABC");
186188
doLogin(pwhash);
187189
```
188190

189191
### Python 3
190192

191-
``` python
193+
``` python linenums="1" hl_lines="10 11 12"
192194
import requests
193195
from hashlib import sha256
194196

195197
url = "http://pi.hole/api/auth"
196198

197199
password = b"ABC"
198-
pwhash = sha256(sha256(password).hexdigest().encode("ascii")).hexdigest().encode("ascii")
200+
pwhash_ = sha256(password).hexdigest().encode("ascii")
201+
pwhash = sha256(pwhash_).hexdigest().encode("ascii")
199202

200203
challenge = requests.get(url).json()["challenge"].encode('ascii')
201204
response = sha256(challenge + b":" + pwhash).hexdigest().encode("ascii")
@@ -213,9 +216,9 @@ The result of a successful authentication is
213216
{
214217
"session":
215218
{
216-
"valid": true,
217-
"sid": "XwrWDU7EDg64dX0sxmURDA==",
218-
"validity": 300
219+
"valid": true,
220+
"sid": "XwrWDU7EDg64dX0sxmURDA==",
221+
"validity": 300
219222
}
220223
}
221224
```

mkdocs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ theme:
1717
code: 'Roboto Mono'
1818

1919
markdown_extensions:
20-
# Code highlighting in ``` ``` blocks
21-
- codehilite:
22-
guess_lang: true
20+
# Code highlighting in ``` ``` blocks, superseeds codehilite
21+
- pymdownx.highlight
22+
# allows for the nesting of code blocks inside other blocks
23+
- pymdownx.superfences
2324
# Table of Contents
2425
- toc:
2526
permalink: true

0 commit comments

Comments
 (0)