{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "subscript-docs",
  "title": "Subscript",
  "description": "Format inline text below the baseline.",
  "files": [
    {
      "path": "../../content/docs/(plugins)/(marks)/subscript.mdx",
      "content": "---\ntitle: Subscript\ndescription: Format inline text below the baseline.\ndocs:\n  - route: /docs/basic-marks\n    title: Basic Marks\n  - route: /docs/superscript\n    title: Superscript\n  - route: /docs/components/more-toolbar-button\n    title: More Toolbar Button\n  - route: /docs/plugin-shortcuts\n    title: Plugin Shortcuts\n---\n\nSubscript applies the `subscript` leaf mark to selected text. Its toggle transform removes `superscript`, so the same text cannot keep both vertical-position marks through the plugin API.\n\n<ComponentPreview name=\"basic-marks-demo\" />\n\n<PackageInfo>\n\n## Features\n\n- `KEYS.sub` leaf mark.\n- Directional selection affinity.\n- HTML deserialization from `sub` and `vertical-align: sub`.\n- `<sub>` rendering by default.\n- Optional Markdown-style input rule through `SubscriptRules`.\n- Mutual exclusion with `KEYS.sup`.\n\n</PackageInfo>\n\n## Kit Usage\n\n<Steps>\n\n### Add Basic Marks\n\n`BasicMarksKit` includes `SubscriptPlugin`, the `~` input rule, and a `mod+comma` shortcut.\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 Control\n\nThe registry `MoreToolbarButton` toggles subscript from the More menu and removes superscript.\n\n```tsx\nimport { MoreToolbarButton } from '@/components/ui/more-toolbar-button';\n\nexport function FormattingMoreMenu() {\n  return <MoreToolbarButton />;\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 `SubscriptPlugin` directly when you want the default `<sub>` render.\n\n```tsx\nimport { SubscriptPlugin } from '@platejs/basic-nodes/react';\nimport { createPlateEditor } from 'platejs/react';\n\nexport const editor = createPlateEditor({\n  plugins: [SubscriptPlugin],\n});\n```\n\nConfigure the input rule and shortcut when you want the same behavior as the kit.\n\n```tsx\nimport { SubscriptRules } from '@platejs/basic-nodes';\nimport { SubscriptPlugin } from '@platejs/basic-nodes/react';\n\nexport const subscriptPlugin = SubscriptPlugin.configure({\n  inputRules: [SubscriptRules.markdown()],\n  shortcuts: { toggle: { keys: 'mod+comma' } },\n});\n```\n\n## Ownership\n\n| Surface | Owner | What It Does |\n|---------|-------|--------------|\n| `BaseSubscriptPlugin` | `@platejs/basic-nodes` | Headless subscript mark, HTML parser, render tag, selection rule, and `toggle` transform. |\n| `SubscriptPlugin` | `@platejs/basic-nodes/react` | React wrapper for the headless subscript mark. |\n| `SubscriptRules.markdown` | `@platejs/basic-nodes` | Optional `~` mark input rule factory. |\n| `BasicMarksKit` | Registry | Adds `SubscriptPlugin`, the input rule, and `mod+comma`. |\n| `MoreToolbarButton` | Registry UI | Calls `editor.tf.toggleMark(KEYS.sub, { remove: KEYS.sup })`. |\n\nThe package owns subscript semantics. The registry owns shortcut configuration and toolbar placement.\n\n## Behavior\n\n| Behavior | Source |\n|----------|--------|\n| Mark key | `KEYS.sub` (`subscript`) |\n| Leaf behavior | `node.isLeaf: true` |\n| Toggle transform | `editor.tf.subscript.toggle()` calls `editor.tf.toggleMark(type, { remove: editor.getType(KEYS.sup) })`. |\n| Selection affinity | `directional` |\n| HTML tags | `sub` |\n| HTML styles | `vertical-align: sub` |\n| Render output | `sub` |\n| Kit input rule | `SubscriptRules.markdown()` |\n| Kit shortcut | `mod+comma` |\n\n## API Reference\n\n| API | Package | Use |\n|-----|---------|-----|\n| `BaseSubscriptPlugin` | `@platejs/basic-nodes` | Headless subscript plugin. |\n| `SubscriptPlugin` | `@platejs/basic-nodes/react` | React subscript plugin. |\n| `SubscriptRules.markdown()` | `@platejs/basic-nodes` | Creates the `~` mark input rule. |\n| `tf.subscript.toggle()` | `@platejs/basic-nodes` | Toggles subscript and removes superscript. |\n",
      "type": "registry:file",
      "target": "content/docs/plate/(plugins)/(marks)/subscript.mdx"
    }
  ],
  "type": "registry:file"
}