Skip to main content
Mintlify renders code with syntax highlighting out of the box. Whether you need a quick inline reference or a full multi-language example with tabs, the options below cover the most common cases.

Inline code

Wrap a word or short expression in single backticks to render it as inline code:
Run the `npm install` command before starting the server.
Run the npm install command before starting the server.

Fenced code blocks

Use triple backticks with a language tag to render a syntax-highlighted code block:
```javascript
const greeting = 'Hello, world!';
console.log(greeting);
```
const greeting = 'Hello, world!';
console.log(greeting);
Always include a language tag. Supported languages include javascript, typescript, python, bash, json, yaml, mdx, sql, and many more.

Named code blocks

Add a filename after the language tag to label the code block with a file name:
```java HelloWorld.java
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
```
HelloWorld.java
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
The filename appears as a label at the top of the block, making it easy for readers to identify which file the snippet belongs to.

Multi-language examples with CodeGroup

Use the CodeGroup component to display the same example in multiple languages or package managers as a tabbed interface:
<CodeGroup>

```bash npm
npm install my-package
```

```bash yarn
yarn add my-package
```

```bash pnpm
pnpm add my-package
```

</CodeGroup>
npm install my-package
Each fenced block inside CodeGroup becomes one tab. The tab label is taken from the filename you provide after the language tag.