Code Blocks
Basics
Inline code
Wrap inline code in backticks. Add {lang="ts-type"} for TypeScript highlighting:
useMovkI18n() returns Ref<string>`useMovkI18n()` returns `Ref<string>`{lang="ts-type"}
Code blocks
Put the language after three backticks. Light mode uses github-light and dark mode github-dark, switching with the site theme:
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs']
})
```ts
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs']
})
```
The layer preloads bash, shell, diff, json, js, ts, html, css, vue, mdc, md and yaml, plus mermaid when Mermaid is enabled. Add other languages to content.build.markdown.highlight.langs.
Filenames
Put a filename in square brackets after the language. The header shows the filename with an icon matched by extension:
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs']
})
```ts [nuxt.config.ts]
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs']
})
```
Line highlights
List the lines to highlight in curly braces after the filename, as single lines or ranges:
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs'],
movkNuxtDocs: {
mermaid: true
}
})
```ts [nuxt.config.ts] {3-5}
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs'],
movkNuxtDocs: {
mermaid: true
}
})
```
Copy button
Every code block has a copy button in the top-right corner. After a click its label changes from "Copy" to "Copied" and resets after about 2 seconds. The label follows the current language.
Color and icon previews
Literal color values in code (such as #d64b34 or rgb(214 75 52)) get a swatch, and icon names such as i-lucide-* get the matching icon. Tailwind palette names (such as primary: 'vermilion') get no swatch:
export default defineAppConfig({
ui: {
colors: {
primary: 'vermilion'
}
},
toc: {
bottom: {
links: [{ icon: 'i-lucide-message-circle-code', label: 'llms.txt', to: '/llms.txt' }]
}
}
})
@theme static {
--color-brand-500: #d64b34;
}
app/app.config.ts:export default defineAppConfig({
ui: {
prose: {
codeIcon: {
terminal: 'i-lucide-square-terminal'
}
}
}
})
Combining code blocks
CodeGroup
code-group turns several code blocks into tabs, for different package managers or alternative approaches:
pnpm add @movk/nuxt-docs
npm install @movk/nuxt-docs
yarn add @movk/nuxt-docs
bun add @movk/nuxt-docs
::code-group
```bash [pnpm]
pnpm add @movk/nuxt-docs
```
```bash [npm]
npm install @movk/nuxt-docs
```
```bash [yarn]
yarn add @movk/nuxt-docs
```
```bash [bun]
bun add @movk/nuxt-docs
```
::
Code groups whose tabs are all package managers (pnpm, npm, yarn, bun, deno) or all TypeScript / JavaScript code stay in sync across the site: switching to npm in one place switches every similar group on other pages too, and the choice is remembered on the next visit. The layer puts the tabs of these groups in a consistent order. To switch a group independently, give it its own sync value, for example ::code-group{sync="my-group"}.
CodeTree
code-tree shows a set of related files as a file tree; default-value selects the file opened first:
---
title: Introduction
description: One sentence about the project.
---
## Quick start
CodePreview
code-preview stacks the rendered result above its source: the default slot holds what to render and the #code slot holds the code to show. Every example on this page uses it:
inline code`inline code`
::code-preview
`inline code`
#code
```mdc
`inline code`
```
::
CodeCollapse
code-collapse folds long code until the reader expands it:
@theme static {
--color-vermilion-50: #fdf3f1;
--color-vermilion-100: #fbe4df;
--color-vermilion-200: #f7cbc2;
--color-vermilion-300: #f0a495;
--color-vermilion-400: #e57461;
--color-vermilion-500: #d64b34;
--color-vermilion-600: #bf3a24;
--color-vermilion-700: #9f2f1d;
--color-vermilion-800: #842a1c;
--color-vermilion-900: #6e281d;
--color-vermilion-950: #3c110a;
}
::code-collapse
```css [app/assets/css/colors.css]
@theme static {
--color-vermilion-50: #fdf3f1;
/* ... */
--color-vermilion-950: #3c110a;
}
```
::
Markdown Syntax
Docs pages are written in standard Markdown. Headings drive the table of contents and anchors, while emphasis, links, lists, tables and blockquotes structure the content. This page lists the common syntax and how Movk Nuxt Docs renders it.
MDC Components
Embed Nuxt UI prose components in Markdown with MDC syntax, including callouts, badges, cards, accordions, tabs, steps, fields, icons and keyboard keys, to structure richer docs without writing Vue code.