Code Syntax Highlighting

Code blocks are automatically syntax-highlighted using PrismJS[1].

Basic Usage

Specify the language after the opening fence:

```java
System.out.println("Hello, World!");
```

Every code block includes a Copy button for easy clipboard copying.

Supported Languages

All 290+ PrismJS languages[2] are supported, including:

  • Web: HTML, CSS, JavaScript, TypeScript, JSON
  • Backend: Java, Python, Go, Rust, C#, Ruby, PHP
  • Config: YAML, XML, TOML, INI, Properties
  • Shell: Bash, PowerShell, Batch
  • Database: SQL, GraphQL
  • And many more…

Language components load automatically on demand.

Examples

Java

```java
public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello!");
    }
}
```

Shell Commands

```bash
echo $HOME > /tmp/my-home.txt
```

Shell with Output

```shell-session
$ ls -l
total 0
-rw-r--r-- 1 user user 0 Jan 1 00:00 file.txt
```

YAML

```yaml
server:
  port: 8080
  host: localhost
```

XML

```xml
<dependency>
  <groupId>org.example</groupId>
  <artifactId>my-lib</artifactId>
</dependency>
```

SQL

```sql
SELECT * FROM users WHERE active = true;
```

Docker

```docker
FROM ubuntu:22.04
COPY . /app
CMD ["python", "/app/app.py"]
```
function printPage() {
	window.print();
}


````md
```json
{
	"myArray": [3, 1, 4, 1, 5, 2, 9],
	"other": null
}
```

Markdown

```md
This is a **bold** move, [do it!](https://sentrysoftware.org).
```

PowerShell

```ps
Get-CimInstance -ClassName Win32_OperatingSystem | Invoke-CimMethod -MethodName Shutdown
```

PSL

```psl
print("home: ".get("/patrolHome")."\n");
```

Regular Expressions

```regex
[Bb]rainf\*\*k
```

SQL

```sql
SELECT value FROM table WHERE name="test" -- Testing
```

xml

```xml
<item name="test">42</item> <!-- Test -->
```

YAML

```yaml
myArray: [3, 1, 4, 1, 5, 9, 2]
other:
    main: null # This is null
    rest: "nothing"
```

Java

```java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
```

Python

```python
def greet(name: str) -> str:
    return f"Hello, {name}!"

print(greet("World"))
```

TypeScript

```typescript
interface User {
	name: string;
	age: number;
}

const greet = (user: User): string => `Hello, ${user.name}!`;
```

Note:

Syntax highlighting for fenced code blocks is available only when using version 3.10 (and later) of maven-site-plugin.

Next Steps

Searching...
No results.