Skip to content

Commit

Permalink
Add support for code blocks and inline highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Dec 23, 2020
1 parent 640bc32 commit 71e53f7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
23 changes: 21 additions & 2 deletions api/documentation/docs/Material for mkdocs Formatting.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Material for mkdocs Formatting

## Admonitions

See: [Material for mkdocs: Admonitions](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonitions)

!!! note
Expand All @@ -22,4 +21,24 @@ See: [Material for mkdocs: Admonitions](https://squidfunk.github.io/mkdocs-mater
!!! success "Custom Title"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
massa, nec semper lorem quam in massa.


## Code Blocks
See: [Material for mkdocs: Code Blocks](https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#highlight)

``` python
# This is a Python code block.
print("Hello world!") if __name__ == "__main__"
```
``` js linenums="1"
# This is a JavaScript code block with line numbers.
( _ => console.log("Hello world!"))();
```
``` md hl_lines="3"
# This is a Markdown code block with line highlights and nested code block.
``` js
( _ => console.log("Hello world!"))();
```
```
This is an inline Java highlight `#!java system.out.println("Hello world!")`
6 changes: 6 additions & 0 deletions api/documentation/docs/javascript/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Configure Highlight.js for code highlighting
* See: https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#highlight
*/

hljs.initHighlighting()
11 changes: 9 additions & 2 deletions api/documentation/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- codehilite
- pymdownx.highlight
- pymdownx.inlinehilite
- mkautodoc


Expand Down Expand Up @@ -47,4 +48,10 @@ extra:
name: webqueue2 on Slack
- icon: fontawesome/brands/github
link: https://github.itap.purdue.edu/ECN/webqueue2
name: webqueue2 on GitHub
name: webqueue2 on GitHub

extra_javascript:
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js
- javascript/config.js
extra_css:
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css

0 comments on commit 71e53f7

Please sign in to comment.