FeaturesMarks
Italic
Make text italic with `toggleItalic`.
Type: Mark · Category: Marks
Italic slants text to the right for emphasis. Renders as <em> in HTML output.
Demo
Installation
import { Italic } from "@arkpad/extension-italic";Commands
The extension registers three commands for managing italic styling:
// Toggles italic styling on and off for the active selection
editor.runCommand("toggleItalic");
// Explicitly applies italic styling to the selection
editor.runCommand("setItalic");
// Explicitly removes italic styling from the selection
editor.runCommand("unsetItalic");Chaining Commands
You can chain commands to toggle italic styling and immediately focus the editor:
editor.chain().focus().toggleItalic().run();Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Mod-i or Mod-I | Toggles italic styling |
Markdown Input Rules
Type these patterns at both ends of a word or phrase to quickly make it italic:
*italic*_italic_
Active State
const isActive = editor.isActive("italic");Configuration
Options
| Name | Type | Default | Description |
|---|---|---|---|
HTMLAttributes | Record<string, any> | {} | Key-value pairs of attributes to be rendered on the <em> DOM element. |
Italic.configure({
HTMLAttributes: {
class: "custom-italic-styling",
},
});