Skip to content

Added client-side highlighting using highlight.js #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/formatters/biased.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
Generate a random `integer`, with a bias using a given function.

```php
function biasedNumberBetween(int $min = 0, int $max = 100, string $function = 'sqrt'): int;
function biasedNumberBetween(
int $min = 0,
int $max = 100,
string $function = 'sqrt'
): int;
```

Examples:
Expand Down
2 changes: 1 addition & 1 deletion docs/formatters/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To provide a less verbose explanation of this function, we'll use a function def
function imageUrl(
int $width = 640,
int $height = 480,
?string $category = null, // used as text on the image
?string $category = null, /* used as text on the image */
bool $randomize = true,
?string $word = null,
bool $gray = false
Expand Down
9 changes: 9 additions & 0 deletions docs/javascripts/highlight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Add a custom event listener, dispatched by Material for MkDocs.
// <https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/instant/index.ts#L247>
document.addEventListener('DOMContentSwitch', () => {
// Reset the "called" boolean
hljs.initHighlighting.called = false;
hljs.initHighlighting();
});

hljs.initHighlightingOnLoad();
14 changes: 9 additions & 5 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ markdown_extensions:
permalink: '#'
- pymdownx.details: { }
- pymdownx.highlight:
extend_pygments_lang:
- name: php
lang: php
options:
startinline: true
use_pygments: false
- pymdownx.superfences: { }
- pymdownx.keys: { }

extra_javascript:
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/highlight.min.js
- javascripts/highlight.js

# Themes can be found here: <https://github.com/highlightjs/highlight.js/tree/master/src/styles>
extra_css:
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.4.0/styles/atom-one-dark-reasonable.min.css