Syntax Highlighting
Qiandu uses Chroma, a pure Golang implementation of code highlighting renderer. It is recommended to use backticks for code blocks in Markdown content, for example:
Markdown
```python
def say_hello():
print("Hello!")
```Will be rendered as:
def say_hello():
print("Hello!")Features
Filename
To add a filename or title to a code block, set filename:
Markdown
```python {filename="hello.py"}
def say_hello():
print("Hello!")
```hello.py
def say_hello():
print("Hello!")Line Numbers
To set line numbers, set linenos to table, and set linenostart to the starting line number:
Markdown
```python {linenos=table,linenostart=42}
def say_hello():
print("Hello!")
```
|
|
Highlight Lines
Display highlighted lines, set hl_lines to line numbers:
Markdown
```python {linenos=table,hl_lines=[2,4],linenostart=1,filename="hello.py"}
def say_hello():
print("Hello!")
def main():
say_hello()
```hello.py
|
|
Copy button
By default, the code block copy button is automatically enabled.
Supported programming languages
For more information about supported programming languages, go to Chroma’s documentation.