Starter KitStarter Kit

Code Blocks

Display inline code and code blocks

Edit on GitHub

Basic

Inline Code

To denote a word or phrase as code, enclose it in backticks (`).

To denote a `word` or `phrase` as code, enclose it in backticks (`).

Code Block

Use fenced code blocks by enclosing code in three backticks and follow the leading ticks with the programming language of your snippet to get syntax highlighting. Optionally, you can also write the name of your code after the programming language. Syntax Highlighting is supported by default using Rehype Code.

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

Advanced

Package Install

The package install block automatically detects common package managers (npm, yarn, pnpm) and displays installation commands for each. Users can switch between different package managers using tabs.

```package-install
npm i next -D
```

Shiki Transformers

We support some of the Shiki Transformers, allowing you to highlight/style specific lines.

```tsx
// highlight a line
<div>Hello World</div>  // [!code highlight]
 
// highlight a word
// [!code word:Fumadocs]
<div>Fumadocs</div>
 
// diff styles
console.log('hewwo'); // [!code --]
console.log('hello'); // [!code ++]
```

Twoslash Notations

Learn more about Twoslash notations.

Test
.g
  • group
  • groupCollapsed
  • groupEnd
;
const
const player: Player
player
: = { : 'Hello World' };
const  = '123';
 
.();
 
import {  } from 'fumadocs-openapi';
 
void ({
  : ['./museum.yaml'],
  : './content/docs/ui',
});
const  = '123';
 
a = 132;
Cannot assign to 'a' because it is a constant.

On this page