Overview – inksane
inksane
Extensions

Overview

Register extensions and kits, choose individual features, and migrate from automatic defaults.

Extensions register commands, keybindings, Markdown parser additions, decorations, HTML converters, and CodeMirror extensions. An extension can also bundle child extensions.

Core loads no feature extensions automatically. Without extensions, it still parses Markdown and provides the editor lifecycle, document access, and the clearContent, cutContent, deleteContent, focus, insertContent, and setContent commands.

Kits

A kit bundles several extensions into one configuration. BaseKit provides the standard Markdown features, history, editing shortcuts, and placeholder support. Pass BaseKit() through the editor’s extensions option for the standard setup.

See the BaseKit reference for setup, options, and replacing a kit feature.

Individual imports

Import only the extensions you want and pass them through extensions. Most feature extensions are objects. LinkExtension and BaseKit are factories:

import { Editor } from "@inksane/core";
import { BoldExtension } from "@inksane/core/extensions/bold";
import { ItalicExtension } from "@inksane/core/extensions/italic";

const editor = new Editor({
  element: mount,
  extensions: [BoldExtension, ItalicExtension],
});

All feature imports use the prefix @inksane/core/extensions/:

FeatureImport suffixExport
BoldboldBoldExtension
ItalicitalicItalicExtension
StrikethroughstrikethroughStrikethroughExtension
LinklinkLinkExtension
ImageimageImageExtension
CodecodeCodeExtension
HeadingheadingHeadingExtension
ListlistListExtension
Task listtask-listTaskListExtension
FootnotesfootnotesFootnoteExtension
BlockquoteblockquoteBlockquoteExtension
Horizontal rulehorizontal-ruleHorizontalRuleExtension
HTMLhtmlHtmlExtension
HistoryhistoryHistoryExtension
Tab indentationkeybindsKeybindExtension
Editing and search shortcutskeybindsDefaultKeymapExtension
PlaceholderplaceholderPlaceholderExtension

Disabling a feature removes its commands, keybindings, decorations, state queries, HTML converters, and parser additions. Standard Markdown syntax remains available in the underlying parser. For example, bold: false leaves **text** in the document but removes the bold feature’s editor behavior. Disabling strikethrough also removes its GFM parser support, so ~~text~~ stays literal.

Commands and types

Importing a feature also loads its TypeScript command declarations. Importing BaseKit loads the declarations for its child extensions. These types describe imported features, not which options are enabled on a particular editor. A kit command can still appear in TypeScript when its feature is disabled, even though that command is absent at runtime.

Add your own extension

Add custom extensions beside the kit or your selected features:

import { Editor, type Extension } from "@inksane/core";
import { BaseKit } from "@inksane/core/extensions/base-kit";

const MyExtension: Extension = {
  name: "my-extension",
};

const editor = new Editor({
  element: mount,
  extensions: [BaseKit(), MyExtension],
});

Names must be unique

Each distinct extension name must be unique across the complete extension tree. Duplicate names and circular child-extension graphs throw while the editor is created. Reusing the same child instance through multiple parents is deduplicated.

priority is optional and defaults to 0. Higher-priority extensions are initialized first. Command names should be unique too. Priority does not resolve command-name collisions.

Migrate from automatic defaults

To preserve the previous standard setup, add extensions: [BaseKit()] to your editor options. React bindings also accept this option.

Previous setupNew setup
Automatic feature extensionsRegister BaseKit() or individual extensions.
LinkExtension imported from @inksane/coreImport it from @inksane/core/extensions/link.
placeholderTheme imported from @inksane/coreImport it from @inksane/core/extensions/placeholder.
Editor option defaultKeymap: falsePass BaseKit({ defaultKeymap: false }) through extensions.
A configured extension replaces the default by nameDisable the kit feature before adding its replacement.

LinkOptions and LinkRequestContext now come from the link subpath. PlaceholderThemeStyles comes from the placeholder subpath. Core document commands remain available without a kit.

Next steps