{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "underline-docs",
  "title": "Underline",
  "description": "Add underlined inline text.",
  "files": [
    {
      "path": "../../content/docs/(plugins)/(marks)/underline.mdx",
      "content": "---\ntitle: Underline\ndescription: Add underlined inline text.\ndocs:\n  - route: /docs/basic-marks\n    title: Basic Marks\n  - route: /docs/components/mark-toolbar-button\n    title: Mark Toolbar Button\n  - route: /docs/plugin-shortcuts\n    title: Plugin Shortcuts\n---\n\nUnderline applies the `underline` leaf mark to selected text. `UnderlinePlugin` owns the mark key, shortcut, HTML parsing, render tag, and toggle transform.\n\n<ComponentPreview name=\"basic-marks-demo\" />\n\n<PackageInfo>\n\n## Features\n\n- `KEYS.underline` leaf mark.\n- Default `⌘U` / `Ctrl+U` shortcut.\n- HTML deserialization from `u` and underline text decoration.\n- `<u>` rendering by default.\n- Optional Markdown-style input rule through `UnderlineRules`.\n- Toolbar support through `MarkToolbarButton`.\n\n</PackageInfo>\n\n## Kit Usage\n\n<Steps>\n\n### Add Basic Marks\n\n`BasicMarksKit` includes `UnderlinePlugin`, the underscore input rule, and the standard toolbar buttons that use `KEYS.underline`.\n\n<ComponentSource name=\"basic-marks-kit\" />\n\n```tsx\nimport { createPlateEditor } from 'platejs/react';\n\nimport { BasicMarksKit } from '@/components/editor/plugins/basic-marks-kit';\n\nexport const editor = createPlateEditor({\n  plugins: [...BasicMarksKit],\n});\n```\n\n### Add A Toolbar Button\n\nUse `MarkToolbarButton` with `KEYS.underline`.\n\n```tsx\nimport { UnderlineIcon } from 'lucide-react';\nimport { KEYS } from 'platejs';\n\nimport { MarkToolbarButton } from '@/components/ui/mark-toolbar-button';\n\nexport function UnderlineToolbarButton() {\n  return (\n    <MarkToolbarButton nodeType={KEYS.underline} tooltip=\"Underline (⌘+U)\">\n      <UnderlineIcon />\n    </MarkToolbarButton>\n  );\n}\n```\n\n</Steps>\n\n## Manual Usage\n\nInstall the mark package.\n\n```bash\nnpm install @platejs/basic-nodes\n```\n\nAdd `UnderlinePlugin` directly when you do not want the whole kit.\n\n```tsx\nimport { UnderlinePlugin } from '@platejs/basic-nodes/react';\nimport { createPlateEditor } from 'platejs/react';\n\nexport const editor = createPlateEditor({\n  plugins: [UnderlinePlugin],\n});\n```\n\nRegister the Markdown-style input rule when users should type underline delimiters.\n\n```tsx\nimport { UnderlineRules } from '@platejs/basic-nodes';\nimport { UnderlinePlugin } from '@platejs/basic-nodes/react';\n\nexport const underlinePlugin = UnderlinePlugin.configure({\n  inputRules: [UnderlineRules.markdown()],\n});\n```\n\n## Ownership\n\n| Surface | Owner | What It Does |\n|---------|-------|--------------|\n| `BaseUnderlinePlugin` | `@platejs/basic-nodes` | Headless underline mark, HTML parser, render tag, and `toggle` transform. |\n| `UnderlinePlugin` | `@platejs/basic-nodes/react` | React wrapper with default `mod+u` shortcut. |\n| `UnderlineRules.markdown` | `@platejs/basic-nodes` | Optional mark input rule factory. |\n| `BasicMarksKit` | Registry | Adds `UnderlinePlugin` with the underscore input rule. |\n| `MarkToolbarButton` | Registry UI | Reads active mark state and calls the mark toggle hook. |\n\nThe package owns the mark. The registry owns toolbar placement and icon choice.\n\n## Behavior\n\n| Behavior | Source |\n|----------|--------|\n| Mark key | `KEYS.underline` |\n| Leaf behavior | `node.isLeaf: true` |\n| Toggle transform | `editor.tf.underline.toggle()` calls `editor.tf.toggleMark(type)`. |\n| Shortcut | `UnderlinePlugin` registers `mod+u`. |\n| HTML tags | `u` |\n| HTML styles | `text-decoration: underline` |\n| HTML guard | Ignores descendants where `textDecoration` is `none`. |\n| Render output | `u` |\n\n## API Reference\n\n| API | Package | Use |\n|-----|---------|-----|\n| `BaseUnderlinePlugin` | `@platejs/basic-nodes` | Headless underline plugin. |\n| `UnderlinePlugin` | `@platejs/basic-nodes/react` | React underline plugin with shortcut defaults. |\n| `UnderlineRules.markdown()` | `@platejs/basic-nodes` | Creates the underline mark input rule. |\n| `tf.underline.toggle()` | `@platejs/basic-nodes` | Toggles the underline mark at the selection. |\n",
      "type": "registry:file",
      "target": "content/docs/plate/(plugins)/(marks)/underline.mdx"
    }
  ],
  "type": "registry:file"
}