Code Blocks Highlights
Table of Contents
This page provides examples on how to include code blocks with syntax highlighting.
Inline Code
To include inline code, use single backticks:
This is `Inline code`.
Rendered as:
This is Inline Code
.
Code block with no highlights
For a basic code block without syntax highlighting, use the following:
```
// ... code
```
Rendered as:
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
Code block with highlights
Mention the language for syntax highlighting, right next to the opening code fence:
```c
// ... code
```
Rendered as:
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return 0;
}
Code block with highlights and line numbers
```c {linenos=true}
// ... code
```
Rendered as:
|
|
linenos=inline
is not supported.Code with highlighted lines.
```c {linenos=true, hl_lines=[1,4]}
// ... code
```
|
|