Syntax Highlighting
Syntax highlighting in code blocks comes pre-installed and is done using the codehilite and fenced_code extensions.
All available themes are downloadable here and CSS files should be in your assets folder.
You can create code blocks (language name can be deduced):
- With a shebang (to show line numbers)
1 2 |
|
- With three backticks (uses attr_list)
```python
print("Hello World!")
```
If you want to highlight lines, you can use the hl_lines
option:
- With three backticks (uses attr_list)
``` { .python hl_lines="1 3" }
print("Hello", end=" ")
print("World", end="")
print("!")
```
- With a shebang (to show line numbers)
1 2 3 4 |
|