export const packageManagers = ['yarn', 'pnpm', 'npm'];
// !languageexport const packageManagers = ['yarn', 'pnpm', 'npm'];
// !no-languageexport const packageManagers = ['yarn', 'pnpm', 'npm'];
Annotations are the small authored markers that turn plain MDX into structured website content. They define project subpages, stable slugs, summaries, showcased files, and code presentation details without moving that information into route code.
This page collects the building blocks that are useful when writing by hand and when asking agents to produce content. Each section shows the source pattern first, then explains what the rendered page does with it.
Block-level presentation annotations control default chrome, line indicators, headers, and overlay controls without requiring a custom component in the MDX file.
Code blocks show their current language as a label by default. It does not switch or change the code. Use !no-language to hide it, or !language to enable it explicitly.
export const packageManagers = ['yarn', 'pnpm', 'npm'];
// !languageexport const packageManagers = ['yarn', 'pnpm', 'npm'];
// !no-languageexport const packageManagers = ['yarn', 'pnpm', 'npm'];
Non-shell code displays line numbers by default. Shell blocks omit them so short commands stay compact, but !line-numbers opts an individual shell example back in. Use !no-line-numbers to opt out of the default on any language.
const managers = ['yarn','pnpm','npm',];
// !line-numbersconst managers = ['yarn','pnpm','npm',];
// !no-line-numbersconst managers = ['yarn','pnpm','npm',];
# !line-numbers# !no-shell-promptfunction website_build() {local project=${1:-website}if [[ $project == website ]]; thenyarn install --immutableyarn moon run "$project:build"elseprint "Unknown project: $project" >&2return 1fi}
Shell blocks show a copy button by default, while non-shell blocks keep copy buttons opt-in. Use !copy to enable copying, or !no-copy to hide it.
// !copyexport const packageManagers = ['yarn', 'pnpm', 'npm'];
When !copy is present alongside the language label, both share the same overlay rail.
The project runs through the repository's Yarn and Moon tasks. Shell blocks show the $ prefix and a copy button by default. Use !no-shell-prompt or !no-copy when a shell block should not show either one, or use !shell-prompt and !copy to add them to another code language.
yarn moon run website:build
# !no-shell-promptyarn moon run website:build
# !no-copyyarn moon run website:build
# !no-copy# !no-shell-promptyarn moon run website:build
Plain fence metadata is rendered as a file name above the code block.
```ts package-manager.tsexport const packageManagers = ['yarn', 'pnpm', 'npm'];```
Annotations can draw attention to a specific part of an example or adjust line presentation without changing the code readers can copy.
!mark highlights the next line. Add a range or regular expression to mark only part of a line, and add a color after the selector to override the theme accent.
function publish(version: string) {// !mark blueassertCleanWorkingTree();// !mark[/version/] goldreturn createRelease(version);}
!diff + and !diff - identify inserted and removed lines. Diff styling reuses the mark annotation so both features retain the same visual structure.
Use !noop before an annotation marker to show that marker as code instead of interpreting it. The noop prefix is omitted from the rendered line.
export function packageCommand(manager: string) {// !diff -return `${manager} install`;// !diff +return manager === 'npm' ? 'npm install' : `${manager} add`;}
!fold replaces matching inline content with an expandable ellipsis. The native disclosure keeps the full text in the server-rendered document and remains expandable without JavaScript.
// !fold[/className="(.*?)"/gm]export function Status() {return <span className="status status--ready">Ready</span>;}
!word-wrap keeps long lines inside the available width and aligns wrapped text with the original indentation.
// !word-wrapconst command = createPackageManagerCommand({ manager: 'yarn', operation: 'exec', package: 'typescript', executable: 'tsc', arguments: ['--watch', '--preserveWatchOutput'] });
Some authoring patterns need more than a single markdown element. These components keep the MDX source readable while letting the rendered page group related examples, controls, or comparisons into one block.
Related code blocks that describe one change across several files belong together rather than stacked one after another.
<CodeWithTabs>```ts !!tabs component.tsxexport function Example() {return <p>Example</p>;}``````ts !!tabs component.css.tsexport const exampleStyle = style({display: 'block',});```</CodeWithTabs>
export function Example() {return <p>Example</p>;}
export const exampleStyle = style({display: 'block',});
The !package annotation describes a package-manager-neutral command and renders the matching Yarn, pnpm, and npm forms as tabs.
Install packages
yarn add typescript zod
pnpm add typescript zod
npm install typescript zod
```sh !package install typescript zod```
Each variant adds the same two packages to the current project and passes their names through unchanged. Only the command differs: Yarn and pnpm distinguish adding a dependency from installing the project, so they use add, while npm overloads install.
Scaffold a project with a one-off package
yarn dlx create-vite my-app --template react-ts
pnpm dlx create-vite my-app --template react-ts
npx create-vite my-app --template react-ts
```sh !package exec create-vite my-app --template react-ts```
Here the binary and the package share a name, so no package needs to be declared. The project name and template arguments are identical everywhere, and only the runner changes: yarn dlx, pnpm dlx, and npx.
Run a binary from a named package
yarn dlx -p typescript tsc --watch
pnpm dlx --package typescript tsc --watch
npx --package typescript tsc --watch
```sh !package exec --package typescript tsc --watch```
When the binary does not match the package that supplies it, the package has to be named explicitly. The runners differ as above, and so does the flag: Yarn spells it -p, while pnpm and npm both use --package.