Extensions
Code Block + Prettier
Format code blocks on demand with Prettier
Adds a "Format" action to code blocks that runs Prettier on the content. Requires Code Block to be installed.
Install
pnpm add @typix-editor/extension-code-block-prettierLive demo
Config
| Option | Type | Default | Description |
|---|---|---|---|
printOptions | Prettier.Options | {} | Forwarded directly to Prettier. |
Supported printOptions include tabWidth, semi, singleQuote,
trailingComma, printWidth, etc. See
Prettier docs.
Helper
import { canFormatWithPrettier } from "@typix-editor/extension-code-block-prettier";
if (canFormatWithPrettier("typescript")) {
// Prettier can handle this language
}