Skip to content

Commit 8ed94da

Browse files
author
Bram Ceulemans
authored
Added client-side highlighting using highlight.js (#12)
* Added client-side highlighting using highlight.js * Shortened function definition of biasedNumberBetween * Changed theme to atom-one-dark-reasonable
1 parent d72d96e commit 8ed94da

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

docs/formatters/biased.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
Generate a random `integer`, with a bias using a given function.
66

77
```php
8-
function biasedNumberBetween(int $min = 0, int $max = 100, string $function = 'sqrt'): int;
8+
function biasedNumberBetween(
9+
int $min = 0,
10+
int $max = 100,
11+
string $function = 'sqrt'
12+
): int;
913
```
1014

1115
Examples:

docs/formatters/image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ To provide a less verbose explanation of this function, we'll use a function def
1010
function imageUrl(
1111
int $width = 640,
1212
int $height = 480,
13-
?string $category = null, // used as text on the image
13+
?string $category = null, /* used as text on the image */
1414
bool $randomize = true,
1515
?string $word = null,
1616
bool $gray = false

docs/javascripts/highlight.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Add a custom event listener, dispatched by Material for MkDocs.
2+
// <https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/instant/index.ts#L247>
3+
document.addEventListener('DOMContentSwitch', () => {
4+
// Reset the "called" boolean
5+
hljs.initHighlighting.called = false;
6+
hljs.initHighlighting();
7+
});
8+
9+
hljs.initHighlightingOnLoad();

mkdocs.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ markdown_extensions:
108108
permalink: '#'
109109
- pymdownx.details: { }
110110
- pymdownx.highlight:
111-
extend_pygments_lang:
112-
- name: php
113-
lang: php
114-
options:
115-
startinline: true
111+
use_pygments: false
116112
- pymdownx.superfences: { }
117113
- pymdownx.keys: { }
114+
115+
extra_javascript:
116+
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/highlight.min.js
117+
- javascripts/highlight.js
118+
119+
# Themes can be found here: <https://github.com/highlightjs/highlight.js/tree/master/src/styles>
120+
extra_css:
121+
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/styles/atom-one-dark-reasonable.min.css

0 commit comments

Comments
 (0)