From zbeyens. The source code is available on GitHub.

Plate
PlatePliteEditorsTemplates
GitHub16kGitHub
DiscordDiscord
    • Stream
    • Copilot
  • Discussion
    • Comments
    • Suggestion
    • Basic Blocks
      • Blockquote
      • Heading
      • Horizontal Rule
    • Callout
    • Code Block
    • Column
    • Date
    • Equation
    • Link
    • List Classic
    • Media
    • MentionElement
    • Table
    • Table of Contents
    • Footnote
    • Toggle
  • Marks
    • Bold
    • Italic
    • Underline
    • Code
    • Highlight
    • Keyboard Input
    • Strikethrough
    • Subscript
    • Superscript
      • Font
      • Line Height
      • Text Align
    • Indent
    • List
      • Exit Break
      • Single Block
      • Trailing Block
    • Autoformat
    • Block Menu
    • Block Placeholder
    • Combobox
      • Emoji
      • MentionElement
      • Slash Command
    • Cursor Overlay
    • Drag & Drop
    • Navigation Feedback
    • Tabbable
    • Toolbar
    • Yjs
    • Multi SelectEditor
    • CSV
    • DOCX
    • HTML
    • Markdown

Basic Marks

PreviousNext

Common inline text formatting marks.

Mark Toolbar ButtonToolbar

Basic Marks covers the common inline formatting marks: bold, italic, underline, strikethrough, code, subscript, superscript, highlight, and kbd. The package owns mark plugins and transforms; the registry kit adds leaf components, toolbar wiring, and Markdown-style input rules.

Bold

Use bold for strong emphasis.

Italic

Use italic for emphasis or stylistic text.

Underline

Use underline for underlined text.

ToggleBold

On This Page

FeaturesKit UsageAdd The KitAdd Toolbar ButtonsOwnershipMark SetInput RulesManual UsageAPI Reference
Build your editor
Production-ready AI template and reusable components.
Get all-access

Strikethrough

Use strikethrough for deleted or replaced text.

Code

Use code for inline code and technical terms.

Subscript

Use script: 'sub' for subscript text.

Superscript

Use script: 'sup' for superscript text.

Kbd

Use kbd for keyboard shortcuts.

Highlight

Use highlight for marked text.

Loading…

Features

  • Leaf plugins for common mark keys.
  • Toggle transforms through each mark plugin.
  • HTML deserialization for semantic tags and styles.
  • Markdown-style input rules in the registry kit.
  • Registry leaves for code, highlight, and keyboard text.
  • Toolbar support through MarkToolbarButton.
Report an issue

Kit Usage

Add The Kit

BasicMarksKit is the full client-side registry kit. It includes mark plugins, input rules, CodeLeaf, HighlightLeaf, and KbdLeaf.

'use client';
 
import {
  BoldRules,
  CodeRules,
  HighlightRules,
  ItalicRules,
  MarkComboRules,
  ScriptRules,
  StrikethroughRules,
  UnderlineRules,
} from '@platejs/basic-nodes';
import {
  BoldPlugin,
  CodePlugin,
  HighlightPlugin,
  ItalicPlugin,
  KbdPlugin,
  ScriptPlugin,
  StrikethroughPlugin,
  UnderlinePlugin,
} from '@platejs/basic-nodes/react';
 
import { CodeLeaf } from '@/components/editor/code';
import { HighlightLeaf } from '@/components/editor/highlight';
import { KbdLeaf } from '@/components/editor/kbd';
 
export const BasicMarksKit = [
  BoldPlugin.configure({
    inputRules: [
      BoldRules.markdown({ variant: '*' }),
      BoldRules.markdown({ variant: '_' }),
      MarkComboRules.markdown({ variant: 'boldItalic' }),
      MarkComboRules.markdown({ variant: 'boldUnderline' }),
      MarkComboRules.markdown({ variant: 'boldItalicUnderline' }),
      MarkComboRules.markdown({ variant: 'italicUnderline' }),
    ],
  }),
  ItalicPlugin.configure({
    inputRules: [
      ItalicRules.markdown({ variant: '*' }),
      ItalicRules.markdown({ variant: '_' }),
    ],
  }),
  UnderlinePlugin.configure({
    inputRules: [UnderlineRules.markdown()],
  }),
  CodePlugin.configure({
    component: CodeLeaf,
    inputRules: [CodeRules.markdown()],
    shortcuts: { toggle: { keys: 'mod+e' } },
  }),
  StrikethroughPlugin.configure({
    inputRules: [StrikethroughRules.markdown()],
    shortcuts: { toggle: { keys: 'mod+shift+x' } },
  }),
  ScriptPlugin.configure({
    inputRules: [
      ScriptRules.markdown({ value: 'sub' }),
      ScriptRules.markdown({ value: 'sup' }),
    ],
    shortcuts: {
      subscript: {
        keys: 'mod+comma',
        handler: ({ editor }) => {
          editor.plugin(ScriptPlugin).update.toggle('sub');
        },
      },
      superscript: {
        keys: 'mod+period',
        handler: ({ editor }) => {
          editor.plugin(ScriptPlugin).update.toggle('sup');
        },
      },
    },
  }),
  HighlightPlugin.configure({
    component: HighlightLeaf,
    inputRules: [
      HighlightRules.markdown({ variant: '==' }),
      HighlightRules.markdown({ variant: '≡' }),
    ],
    shortcuts: { toggle: { keys: 'mod+shift+h' } },
  }),
  KbdPlugin.configure({ component: KbdLeaf }),
] as const;
'use client';
 
import {
  BoldRules,
  CodeRules,
  HighlightRules,
  ItalicRules,
  MarkComboRules,
  ScriptRules,
  StrikethroughRules,
  UnderlineRules,
} from '@platejs/basic-nodes';
import {
  BoldPlugin,
  CodePlugin,
  HighlightPlugin,
  ItalicPlugin,
  KbdPlugin,
  ScriptPlugin,
  StrikethroughPlugin,
  UnderlinePlugin,
} from '@platejs/basic-nodes/react';
 
import { CodeLeaf } from '@/components/editor/code';
import { HighlightLeaf } from '@/components/editor/highlight';




























































import { createPlateEditor } from 'platejs/react';
 
import { BasicMarksKit } from '@/components/editor/basic-marks';
 
export const editor = createPlateEditor({
  plugins: [...BasicMarksKit],
});
import { createPlateEditor } from 'platejs/react';
 
import { BasicMarksKit } from '@/components/editor/basic-marks';
 
export const editor = createPlateEditor({

Add Toolbar Buttons

Use MarkToolbarButton for direct mark toggles.

import { BoldPlugin } from '@platejs/basic-nodes/react';
import { BoldIcon } from 'lucide-react';
 
import { MarkToolbarButton } from '@/components/editor/mark-toolbar-button';
 
export function BoldToolbarButton() {
  return (
    <MarkToolbarButton plugin={BoldPlugin} tooltip="Bold (⌘+B)">
      <BoldIcon />
    </MarkToolbarButton>
  );
}

Ownership

SurfaceOwnerWhat It Does
BasicMarksKitRegistryConfigures the full mark set with input rules and client leaf components.
BaseBasicMarksKitRegistryConfigures static/base mark plugins with static code, highlight, and kbd leaves.
Individual mark plugins@platejs/basic-nodesOwn mark keys, HTML parsing, render tags, and toggle transforms.
MarkToolbarButtonRegistry UIReads mark state and calls the mark toolbar hook.

The package exports each mark capability independently. The registry owns the editable and static mark presets.

Mark Set

MarkPluginDefault propertyRenderNotes
BoldBoldPluginboldstrongDeserializes strong, b, and bold font weight.
ItalicItalicPluginitalicemDeserializes em, i, and italic font style.
UnderlineUnderlinePluginunderlineuDeserializes u and underline text decoration.
StrikethroughStrikethroughPluginstrikethroughsUses directional selection affinity.
CodeCodePlugincodecodeUses hard selection affinity and skips pre HTML parents.
ScriptScriptPluginscriptsub or supUses one `'sub'
HighlightHighlightPluginhighlightmarkUses directional selection affinity.
KbdKbdPluginkbdkbdUses hard selection affinity.

PLUGINS.* identifies each capability. Reusable code reads its configured text property from editor.plugin(Plugin).schema.key.

Boolean mark plugins expose editor.update.<mark>.toggle(). ScriptPlugin exposes editor.update.script.toggle('sub' | 'sup').

Input Rules

BasicMarksKit registers input rules explicitly. The package plugins do not enable them by default.

Rule FamilyKit Registration
BoldRules.markdownvariant: '*' and variant: '_'
ItalicRules.markdownvariant: '*' and variant: '_'
UnderlineRules.markdownDefault underline rule
CodeRules.markdownDefault inline code rule
StrikethroughRules.markdownDefault strikethrough rule
ScriptRules.markdownvalue: 'sub' or value: 'sup'
HighlightRules.markdownvariant: '==' and variant: '≡'
MarkComboRules.markdownBold/italic/underline combinations

See Plugin Input Rules for the runtime model.

Manual Usage

Install the package when you want to compose marks yourself.

pnpm add @platejs/basic-nodes
pnpm add @platejs/basic-nodes

Add only the marks you need.

components/editor/mark-plugins.tsx
import {
  BoldPlugin,
  CodePlugin,
  ItalicPlugin,
  UnderlinePlugin,
} from '@platejs/basic-nodes/react';
 
export const markPlugins = [
  BoldPlugin,
  ItalicPlugin,
  UnderlinePlugin,
  CodePlugin,
];
components/editor/mark-plugins.tsx
import {
  BoldPlugin,
  CodePlugin,
  ItalicPlugin,
  UnderlinePlugin,
} from '@platejs/basic-nodes/react';
 
export const markPlugins = [
  BoldPlugin,
  ItalicPlugin,
  UnderlinePlugin,
  CodePlugin,
];

Use the individual pages for mark-specific setup and component details.

API Reference

APIPackageUse
BasicMarksKitRegistryFull client kit with highlight, kbd, input rules, and leaves.
BaseBasicMarksKitRegistryStatic/base kit for server or static rendering.
MarkToolbarButtonRegistry UIToolbar control for one mark key.
import { KbdLeaf } from '@/components/editor/kbd';
export const BasicMarksKit = [
BoldPlugin.configure({
inputRules: [
BoldRules.markdown({ variant: '*' }),
BoldRules.markdown({ variant: '_' }),
MarkComboRules.markdown({ variant: 'boldItalic' }),
MarkComboRules.markdown({ variant: 'boldUnderline' }),
MarkComboRules.markdown({ variant: 'boldItalicUnderline' }),
MarkComboRules.markdown({ variant: 'italicUnderline' }),
],
}),
ItalicPlugin.configure({
inputRules: [
ItalicRules.markdown({ variant: '*' }),
ItalicRules.markdown({ variant: '_' }),
],
}),
UnderlinePlugin.configure({
inputRules: [UnderlineRules.markdown()],
}),
CodePlugin.configure({
component: CodeLeaf,
inputRules: [CodeRules.markdown()],
shortcuts: { toggle: { keys: 'mod+e' } },
}),
StrikethroughPlugin.configure({
inputRules: [StrikethroughRules.markdown()],
shortcuts: { toggle: { keys: 'mod+shift+x' } },
}),
ScriptPlugin.configure({
inputRules: [
ScriptRules.markdown({ value: 'sub' }),
ScriptRules.markdown({ value: 'sup' }),
],
shortcuts: {
subscript: {
keys: 'mod+comma',
handler: ({ editor }) => {
editor.plugin(ScriptPlugin).update.toggle('sub');
},
},
superscript: {
keys: 'mod+period',
handler: ({ editor }) => {
editor.plugin(ScriptPlugin).update.toggle('sup');
},
},
},
}),
HighlightPlugin.configure({
component: HighlightLeaf,
inputRules: [
HighlightRules.markdown({ variant: '==' }),
HighlightRules.markdown({ variant: '≡' }),
],
shortcuts: { toggle: { keys: 'mod+shift+h' } },
}),
KbdPlugin.configure({ component: KbdLeaf }),
] as const;
plugins: [
...
BasicMarksKit],
});
import { BoldPlugin } from '@platejs/basic-nodes/react'; import { BoldIcon } from 'lucide-react'; import { MarkToolbarButton } from '@/components/editor/mark-toolbar-button'; export function BoldToolbarButton() { return ( <MarkToolbarButton plugin={BoldPlugin} tooltip="Bold (⌘+B)"> <BoldIcon /> </MarkToolbarButton> ); }