{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "heading-docs",
  "title": "Heading",
  "description": "H1 through H6 block elements with shortcuts, input rules, and static renderers.",
  "files": [
    {
      "path": "../../content/docs/(plugins)/(elements)/heading.mdx",
      "content": "---\ntitle: Heading\ndescription: H1 through H6 block elements with shortcuts, input rules, and static renderers.\ndocs:\n  - route: /docs/components/heading-node\n    title: Heading Element\n  - route: /docs/basic-blocks\n    title: Basic Blocks\n  - route: https://pro.platejs.org/docs/components/heading-node\n    title: Plus\n---\n\nHeading adds six block element types, `h1` through `h6`, for document structure. Each level is its own plugin with the same block behavior, HTML parser, toggle transform, and optional Markdown shorthand rule. This page covers registry setup, manual setup, value shape, shortcuts, input rules, and Markdown serialization.\n\n<ComponentPreview name=\"basic-blocks-demo\" />\n\n<PackageInfo>\n\n## Features\n\n- Block `h1` through `h6` elements.\n- Individual `H1Plugin` through `H6Plugin` exports.\n- Grouping `HeadingPlugin` and `BaseHeadingPlugin` with configurable levels.\n- Bound `editor.tf.h1.toggle()` through `editor.tf.h6.toggle()` transforms.\n- `# ` through `###### ` input rules with `HeadingRules.markdown()`.\n- `mod+alt+1` through `mod+alt+6` shortcuts in the registry kit.\n- Editable and static registry heading components.\n\n</PackageInfo>\n\n## Fast Path\n\n<Steps>\n\n### Add Basic Blocks\n\n`BasicBlocksKit` installs paragraph, H1-H6, blockquote, and horizontal rule plugins with Plate UI components. For headings, it configures every level with `HeadingRules.markdown()`, `H*Element`, a reset-on-empty break rule, and `mod+alt+<level>` shortcuts.\n\n<ComponentSource name=\"basic-blocks-kit\" />\n\n```tsx\nimport { createPlateEditor } from 'platejs/react';\n\nimport { BasicBlocksKit } from '@/components/editor/plugins/basic-blocks-kit';\n\nexport const editor = createPlateEditor({\n  plugins: BasicBlocksKit,\n});\n```\n\n### Render Headings\n\n`heading-node` exports `H1Element` through `H6Element`. Each component renders a `PlateElement` with the matching heading tag and navigation-highlight styles.\n\n<ComponentSource name=\"heading-node\" />\n\n### Add Static Rendering\n\nUse `BaseBasicBlocksKit` when rendering read-only content with `platejs/static`.\n\n<ComponentSource name=\"basic-blocks-base-kit\" />\n\n</Steps>\n\n## Ownership\n\n| Layer | Owner | What It Does |\n|-------|-------|--------------|\n| `@platejs/basic-nodes` | Package | Exports base H1-H6 plugins, `BaseHeadingPlugin`, `HeadingRules`, and shared heading rules. |\n| `@platejs/basic-nodes/react` | Package | Exports `H1Plugin` through `H6Plugin`, plus the grouping `HeadingPlugin`. |\n| `basic-blocks-kit` | Registry | Adds H1-H6 React plugins with components, input rules, shortcuts, and reset-on-empty break behavior. |\n| `basic-blocks-base-kit` | Registry | Adds static H1-H6 components for server/static rendering. |\n| `heading-node` | Registry UI | Renders editable and static heading components. |\n| Toolbar and slash UI | Registry UI | Provides H1-H6 turn-into items, H1-H3 insert items, and H1-H3 slash-command items. |\n| `@platejs/markdown` | Package | Serializes and deserializes `h1` through `h6` as Markdown headings. |\n\n`BasicBlocksPlugin` and `BaseBasicBlocksPlugin` are package grouping plugins. They do not install registry UI components; use the registry kits when you want the Plate UI heading styles.\n\n## Manual Setup\n\n<Steps>\n\n### Install Package\n\n```bash\nnpm install @platejs/basic-nodes\n```\n\n### Add Individual Levels\n\nUse individual level plugins when you want registry components, shortcuts, or per-level configuration.\n\n```tsx\nimport { HeadingRules } from '@platejs/basic-nodes';\nimport {\n  H1Plugin,\n  H2Plugin,\n  H3Plugin,\n  H4Plugin,\n  H5Plugin,\n  H6Plugin,\n} from '@platejs/basic-nodes/react';\nimport { createPlateEditor } from 'platejs/react';\n\nimport {\n  H1Element,\n  H2Element,\n  H3Element,\n  H4Element,\n  H5Element,\n  H6Element,\n} from '@/components/ui/heading-node';\n\nexport const editor = createPlateEditor({\n  plugins: [\n    H1Plugin.configure({\n      inputRules: [HeadingRules.markdown()],\n      node: { component: H1Element },\n      rules: { break: { empty: 'reset' } },\n      shortcuts: { toggle: { keys: 'mod+alt+1' } },\n    }),\n    H2Plugin.configure({\n      inputRules: [HeadingRules.markdown()],\n      node: { component: H2Element },\n      rules: { break: { empty: 'reset' } },\n      shortcuts: { toggle: { keys: 'mod+alt+2' } },\n    }),\n    H3Plugin.configure({\n      inputRules: [HeadingRules.markdown()],\n      node: { component: H3Element },\n      rules: { break: { empty: 'reset' } },\n      shortcuts: { toggle: { keys: 'mod+alt+3' } },\n    }),\n    H4Plugin.configure({\n      inputRules: [HeadingRules.markdown()],\n      node: { component: H4Element },\n      rules: { break: { empty: 'reset' } },\n      shortcuts: { toggle: { keys: 'mod+alt+4' } },\n    }),\n    H5Plugin.configure({\n      inputRules: [HeadingRules.markdown()],\n      node: { component: H5Element },\n      rules: { break: { empty: 'reset' } },\n      shortcuts: { toggle: { keys: 'mod+alt+5' } },\n    }),\n    H6Plugin.configure({\n      inputRules: [HeadingRules.markdown()],\n      node: { component: H6Element },\n      rules: { break: { empty: 'reset' } },\n      shortcuts: { toggle: { keys: 'mod+alt+6' } },\n    }),\n  ],\n});\n```\n\n### Use A Headless Group\n\nUse `BaseHeadingPlugin` when you want to install several heading levels without configuring each level by hand.\n\n```tsx\nimport { BaseHeadingPlugin } from '@platejs/basic-nodes';\nimport { createSlateEditor } from 'platejs';\n\nexport const editor = createSlateEditor({\n  plugins: [\n    BaseHeadingPlugin.configure({\n      options: {\n        levels: [1, 2, 3],\n      },\n    }),\n  ],\n});\n```\n\n</Steps>\n\n## Value Shape\n\nHeadings are normal block elements. The heading level is the node `type`.\n\n```tsx\nconst value = [\n  {\n    children: [{ text: 'Installation' }],\n    type: 'h1',\n  },\n  {\n    children: [{ text: 'Install packages' }],\n    type: 'h2',\n  },\n  {\n    children: [{ text: 'Configure editor plugins' }],\n    type: 'h3',\n  },\n];\n```\n\n| Type | HTML Parser | Default Render Tag |\n|------|-------------|--------------------|\n| `h1` | `H1` | `<h1>` |\n| `h2` | `H2` | `<h2>` |\n| `h3` | `H3` | `<h3>` |\n| `h4` | `H4` | `<h4>` |\n| `h5` | `H5` | `<h5>` |\n| `h6` | `H6` | `<h6>` |\n\n`BaseHeadingPlugin.configure({ options: { levels: 3 } })` creates H1 through H3. Passing an array such as `[1, 3, 5]` creates only those levels.\n\n## Editing Behavior\n\nAll heading levels share the same base behavior.\n\n| Behavior | Source |\n|----------|--------|\n| Toggle transform | Each base plugin binds `editor.tf.<level>.toggle()` to `editor.tf.toggleBlock(type)`. |\n| Enter split | Base rules set `break.splitReset: true`; the registry kit also resets an empty heading on break. |\n| Backspace at start | Base rules set `delete.start: 'reset'`. |\n| Empty merge | Base rules set `merge.removeEmpty: true`. |\n| HTML paste | Each level deserializes its matching `H1` through `H6` tag. |\n\n## Input Rules And Shortcuts\n\n`HeadingRules.markdown()` creates a block-start input rule for the configured plugin key.\n\n| Input | Result |\n|-------|--------|\n| `# ` | H1 |\n| `## ` | H2 |\n| `### ` | H3 |\n| `#### ` | H4 |\n| `##### ` | H5 |\n| `###### ` | H6 |\n\nThe registry kit also binds `mod+alt+1` through `mod+alt+6` to the matching toggle transform.\n\n## Registry UI\n\n| Surface | Heading Levels |\n|---------|----------------|\n| Turn Into toolbar | H1-H6 |\n| Insert toolbar | H1-H3 |\n| Slash command | H1-H3 |\n| Editable element | `H1Element` through `H6Element` |\n| Static element | `H1ElementStatic` through `H6ElementStatic` |\n\nStatic heading elements preserve an `id` field by rendering an internal anchor span. That anchor is used by DOCX table-of-contents links.\n\n## Markdown\n\n`@platejs/markdown` maps Markdown heading depth to the matching Plate heading type.\n\n```mdx\n# H1\n## H2\n### H3\n```\n\nSerialization uses the node type to choose Markdown depth. For example, `type: 'h2'` serializes as `##`.\n\n## API Reference\n\n| API | Package | Use |\n|-----|---------|-----|\n| `BaseH1Plugin` through `BaseH6Plugin` | `@platejs/basic-nodes` | Headless heading level plugins. |\n| `BaseHeadingPlugin` | `@platejs/basic-nodes` | Grouping plugin that creates nested heading levels from `options.levels`. |\n| `HeadingRules.markdown()` | `@platejs/basic-nodes` | Creates the `# ` through `###### ` block-start input rules. |\n| `H1Plugin` through `H6Plugin` | `@platejs/basic-nodes/react` | React heading level plugins. |\n| `HeadingPlugin` | `@platejs/basic-nodes/react` | React grouping plugin for heading levels. |\n| `editor.tf.h1.toggle()` through `editor.tf.h6.toggle()` | plugin-bound transforms | Toggle selected blocks to the matching heading level. |\n",
      "type": "registry:file",
      "target": "content/docs/plate/(plugins)/(elements)/heading.mdx"
    }
  ],
  "type": "registry:file"
}