FeaturesMarks
Superscript
Make text superscript with `toggleSuperscript`.
Type: Mark · Category: Marks
Superscript renders text smaller and above the baseline. Useful for footnotes, chemical notations, and mathematical exponents. Renders as <sup> in HTML output.
Demo
Installation
import { Superscript } from "@arkpad/extension-superscript";Commands
The extension registers three commands for managing superscript styling:
// Toggles superscript styling on and off for the active selection
editor.runCommand("toggleSuperscript");
// Explicitly applies superscript styling to the selection
editor.runCommand("setSuperscript");
// Explicitly removes superscript styling from the selection
editor.runCommand("unsetSuperscript");Chaining Commands
You can chain commands to toggle superscript styling and immediately focus the editor:
editor.chain().focus().toggleSuperscript().run();Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Mod-. (Cmd/Ctrl + Period) | Toggles superscript styling |
Active State
const isActive = editor.isActive("superscript");Configuration
Options
| Name | Type | Default | Description |
|---|---|---|---|
HTMLAttributes | Record<string, any> | {} | Key-value pairs of attributes to render on the <sup> DOM element. |
Superscript.configure({
HTMLAttributes: {
class: "custom-super-styling",
},
});