Arkpad
FeaturesMarks

Underline

Underline text with `toggleUnderline`.

Type: Mark · Category: Marks

Underline adds a line below text. Renders as <u> in HTML output.

Demo

Installation

import { Underline } from "@arkpad/extension-underline";

Commands

The extension registers three commands for managing underline styling:

// Toggles underline styling on and off for the active selection
editor.runCommand("toggleUnderline");

// Explicitly applies underline styling to the selection
editor.runCommand("setUnderline");

// Explicitly removes underline styling from the selection
editor.runCommand("unsetUnderline");

Chaining Commands

You can chain commands to toggle underline styling and immediately focus the editor:

editor.chain().focus().toggleUnderline().run();

Keyboard Shortcuts

ShortcutAction
Mod-u or Mod-UToggles underline styling

Active State

const isActive = editor.isActive("underline");

Configuration

Options

NameTypeDefaultDescription
HTMLAttributesRecord<string, any>{}Key-value pairs of attributes to be rendered on the <u> DOM element.
Underline.configure({
  HTMLAttributes: {
    class: "custom-underline-styling",
  },
});