BaseKit
The standard Markdown features, editing shortcuts, history, and placeholder support.
BaseKit bundles the standard editor extensions. It uses the same extension API as individual
features and lives in @inksane/core, so you do not need to install another package.
Core does not load the kit automatically. Register it through the editor’s extensions option.
Setup
Create a mount element, then import Editor and BaseKit:
<div id="editor"></div>import { Editor } from "@inksane/core";
import { BaseKit } from "@inksane/core/extensions/base-kit";
const editor = new Editor({
element: document.getElementById("editor")!,
content: "# Hello inksane",
extensions: [BaseKit()],
});The kit supplies Markdown formatting, commands, and keyboard shortcuts. It also enables history
and the editor’s placeholder and tabSize options. It does not provide typography or a toolbar.
See Styling for themes and content styles.
React bindings accept the same extensions: [BaseKit()] option through useInksane or
InksaneProvider.
Options
All features are enabled by default. Set an option to false to disable it. The link option also
accepts a configuration object. BaseKitOptions is exported from
@inksane/core/extensions/base-kit, and LinkOptions from @inksane/core/extensions/link.
| Option | Type | Default | Feature |
|---|---|---|---|
bold | boolean | true | Bold |
italic | boolean | true | Italic |
strikethrough | boolean | true | Strikethrough |
link | boolean | LinkOptions | true | Link |
image | boolean | true | Image |
code | boolean | true | Inline code and code blocks |
heading | boolean | true | Headings |
list | boolean | true | Bullet and ordered lists |
taskList | boolean | true | Task lists |
footnotes | boolean | true | Footnotes |
blockquote | boolean | true | Blockquotes |
horizontalRule | boolean | true | Horizontal rules |
html | boolean | true | HTML rendering |
history | boolean | true | Undo and redo |
keybinds | boolean | true | Tab indentation |
defaultKeymap | boolean | true | Editing and search shortcuts |
placeholder | boolean | true | Placeholder support |
Configure links
Pass link options directly through the kit. onLinkRequest supplies the URL when Mod-k creates a
link. Return null to cancel. Without this handler, Mod-k stays unbound.
import { Editor } from "@inksane/core";
import { BaseKit } from "@inksane/core/extensions/base-kit";
const editor = new Editor({
element: document.getElementById("editor")!,
extensions: [
BaseKit({
bold: false,
link: {
onLinkRequest: ({ text }) => window.prompt(`Link for "${text}"`),
},
}),
],
});Placeholder and indentation
The kit options enable the features. The editor options set the placeholder text and indentation size:
import { Editor } from "@inksane/core";
import { BaseKit } from "@inksane/core/extensions/base-kit";
const editor = new Editor({
element: document.getElementById("editor")!,
placeholder: "Write some Markdown",
tabSize: 4,
extensions: [BaseKit()],
});BaseKit({ defaultKeymap: false }) disables standard editing and search shortcuts while keeping
the kit’s Tab indentation. To disable both keymap extensions, pass
BaseKit({ defaultKeymap: false, keybinds: false }).
Collaboration history
When using the collaboration extension, pass
BaseKit({ history: false }). Yjs owns undo and redo, so the standard CodeMirror history must stay
disabled.
Replace a feature
Disable a feature in the kit before registering its replacement separately. Extensions are deduplicated by name, so an extension whose name is already registered is skipped. For example, to provide a separate link extension:
import { Editor } from "@inksane/core";
import { BaseKit } from "@inksane/core/extensions/base-kit";
import { LinkExtension } from "@inksane/core/extensions/link";
const editor = new Editor({
element: document.getElementById("editor")!,
extensions: [
BaseKit({ link: false }),
LinkExtension({
onLinkRequest: () => window.prompt("Link URL"),
}),
],
});To build an editor without a kit, choose individual extensions. See the extension overview for command types and migration from automatic defaults.