content/docs/documentation/code-blocks.mdx
The code blocks on the documentation site and the blog are powered by rehype-pretty-code. The syntax highlighting is done using shiki.
It has the following features:
Thanks to Shiki, highlighting is done at build time. No JavaScript is sent to the client for runtime highlighting.
</Callout>import { withContentlayer } from "next-contentlayer"
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
domains: ["avatars.githubusercontent.com"],
},
experimental: {
appDir: true,
serverComponentsExternalPackages: ["@prisma/client"],
},
}
export default withContentlayer(nextConfig)
```ts title="path/to/file.ts"
// Code here
```
```ts {1,3-6}
// Highlight line 1 and line 3 to 6
```
```ts /shadcn/
// Highlight the word shadcn.
```
```ts showLineNumbers
// This will show line numbers.
```