Complete CommonMark preset for Milkdown editor providing all essential plugins for standard markdown editing
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Document structure elements that form the hierarchical content of markdown documents. These nodes represent block-level elements like headings, paragraphs, lists, code blocks, and media.
The root container node that holds all document content.
/**
* Root document container schema with content pattern 'block+'
* Defines the top-level document structure
*/
const docSchema: $node;Basic text content within other nodes.
/**
* Schema for text nodes - the leaf nodes containing actual text content
*/
const textSchema: $node<'text'>;Standard paragraph nodes for regular text content.
/**
* HTML attributes for paragraph nodes
*/
const paragraphAttr: $nodeAttr<'paragraph'>;
/**
* Schema definition for paragraph nodes
*/
const paragraphSchema: $nodeSchema<'paragraph'>;
/**
* Command to convert current selection to paragraph
*/
const turnIntoTextCommand: $command<'TurnIntoText'>;
/**
* Keyboard shortcuts for paragraph operations
* - Mod-Alt-0: Convert to paragraph
*/
const paragraphKeymap: $useKeymap;Heading nodes supporting levels 1-6 with automatic ID generation.
/**
* Context slice for generating heading IDs from node content
* Default implementation converts text to lowercase with dashes
*/
const headingIdGenerator: $ctx<(node: Node) => string>;
/**
* HTML attributes for heading nodes
*/
const headingAttr: $nodeAttr<'heading'>;
/**
* Schema for heading nodes (h1-h6) with id and level attributes
*/
const headingSchema: $nodeSchema<'heading'>;
/**
* Input rule for creating headings using # syntax
* # = h1, ## = h2, etc.
*/
const wrapInHeadingInputRule: $inputRule;
/**
* Command to wrap selection in heading of specified level
*/
const wrapInHeadingCommand: $command<'WrapInHeading'>;
/**
* Command to downgrade heading level (h1 -> h2, etc.)
*/
const downgradeHeadingCommand: $command<'DowngradeHeading'>;
/**
* Keyboard shortcuts for heading operations
* - Mod-Alt-1 through Mod-Alt-6: Create headings
* - Delete/Backspace: Special handling at heading boundaries
*/
const headingKeymap: $useKeymap;Usage Examples:
import { Editor } from "@milkdown/core";
import { headingSchema, wrapInHeadingCommand } from "@milkdown/preset-commonmark";
// Use heading command programmatically
editor.action((ctx) => {
const cmd = ctx.get(wrapInHeadingCommand.key);
cmd({ level: 2 }); // Create h2 heading
});Quote blocks for highlighting quoted content.
/**
* HTML attributes for blockquote nodes
*/
const blockquoteAttr: $nodeAttr<'blockquote'>;
/**
* Schema definition for blockquote nodes
*/
const blockquoteSchema: $nodeSchema<'blockquote'>;
/**
* Input rule for creating blockquotes using > prefix
*/
const wrapInBlockquoteInputRule: $inputRule;
/**
* Command to wrap selection in blockquote
*/
const wrapInBlockquoteCommand: $command<'WrapInBlockquote'>;
/**
* Keyboard shortcuts for blockquote operations
* - Mod-Shift-b: Toggle blockquote
*/
const blockquoteKeymap: $useKeymap;Multi-line code blocks with language specification.
/**
* HTML attributes for code block nodes
*/
const codeBlockAttr: $nodeAttr<'codeBlock'>;
/**
* Schema for code block nodes with language attribute
*/
const codeBlockSchema: $nodeSchema<'code_block'>;
/**
* Input rule for creating code blocks using ``` syntax
*/
const createCodeBlockInputRule: $inputRule;
/**
* Command to create code block with optional language
*/
const createCodeBlockCommand: $command<'CreateCodeBlock'>;
/**
* Command to update language of existing code block
*/
const updateCodeBlockLanguageCommand: $command<'UpdateCodeBlockLanguage'>;
/**
* Keyboard shortcuts for code block operations
* - Mod-Alt-c: Create code block
*/
const codeBlockKeymap: $useKeymap;Usage Examples:
import { createCodeBlockCommand } from "@milkdown/preset-commonmark";
// Create code block with language
editor.action((ctx) => {
const cmd = ctx.get(createCodeBlockCommand.key);
cmd({ language: "typescript" });
});Inline and block image nodes with alt text and titles.
/**
* HTML attributes for image nodes
*/
const imageAttr: $nodeAttr<'image'>;
/**
* Schema for image nodes with src, alt, and title attributes
*/
const imageSchema: $nodeSchema<'image'>;
/**
* Command payload interface for image operations
*/
interface UpdateImageCommandPayload {
src?: string;
title?: string;
alt?: string;
}
/**
* Command to insert new image at cursor position
*/
const insertImageCommand: $command<'InsertImage'>;
/**
* Command to update properties of selected image
*/
const updateImageCommand: $command<'UpdateImage'>;
/**
* Input rule for creating images using  syntax
*/
const insertImageInputRule: $inputRule;Line breaks within paragraphs and other text content.
/**
* HTML attributes for hard break nodes
*/
const hardbreakAttr: $nodeAttr<'hardbreak'>;
/**
* Schema for hard break nodes with isInline attribute
*/
const hardbreakSchema: $nodeSchema<'hardbreak'>;
/**
* Command to insert hard break at cursor position
*/
const insertHardbreakCommand: $command<'InsertHardbreak'>;
/**
* Keyboard shortcuts for hard break operations
* - Shift-Enter: Insert hard break
*/
const hardbreakKeymap: $useKeymap;Thematic breaks represented as horizontal lines.
/**
* HTML attributes for horizontal rule nodes
*/
const hrAttr: $nodeAttr<'hr'>;
/**
* Schema definition for horizontal rule nodes
*/
const hrSchema: $nodeSchema<'hr'>;
/**
* Input rules for creating horizontal rules
* Supports ---, ___, and *** syntax
*/
const insertHrInputRule: $inputRule;
/**
* Command to insert horizontal rule at cursor position
*/
const insertHrCommand: $command<'InsertHr'>;Bullet and ordered lists with full nesting support.
/**
* HTML attributes for bullet list nodes
*/
const bulletListAttr: $nodeAttr<'bulletList'>;
/**
* Schema for bullet list nodes with spread attribute
*/
const bulletListSchema: $nodeSchema<'bullet_list'>;
/**
* Input rules for creating bullet lists using *, -, or + syntax
*/
const wrapInBulletListInputRule: $inputRule;
/**
* Command to wrap selection in bullet list
*/
const wrapInBulletListCommand: $command<'WrapInBulletList'>;
/**
* Keyboard shortcuts for bullet list operations
* - Mod-Alt-8: Create bullet list
*/
const bulletListKeymap: $useKeymap;
/**
* HTML attributes for ordered list nodes
*/
const orderedListAttr: $nodeAttr<'orderedList'>;
/**
* Schema for ordered list nodes with order and spread attributes
*/
const orderedListSchema: $nodeSchema<'ordered_list'>;
/**
* Input rule for creating numbered lists using 1. syntax
*/
const wrapInOrderedListInputRule: $inputRule;
/**
* Command to wrap selection in ordered list
*/
const wrapInOrderedListCommand: $command<'WrapInOrderedList'>;
/**
* Keyboard shortcuts for ordered list operations
* - Mod-Alt-7: Create ordered list
*/
const orderedListKeymap: $useKeymap;Individual items within lists with indentation support.
/**
* HTML attributes for list item nodes
*/
const listItemAttr: $nodeAttr<'listItem'>;
/**
* Schema for list item nodes with label, listType, and spread attributes
*/
const listItemSchema: $nodeSchema<'list_item'>;
/**
* Command to indent (sink) list item to deeper level
*/
const sinkListItemCommand: $command<'SinkListItem'>;
/**
* Command to unindent (lift) list item to shallower level
*/
const liftListItemCommand: $command<'LiftListItem'>;
/**
* Command to split current list item at cursor position
*/
const splitListItemCommand: $command<'SplitListItem'>;
/**
* Command to lift first list item out of list
*/
const liftFirstListItemCommand: $command<'LiftFirstListItem'>;
/**
* Keyboard shortcuts for list item operations
* - Enter: Split list item
* - Tab: Indent list item
* - Shift-Tab: Unindent list item
* - Mod-[: Unindent list item
* - Mod-]: Indent list item
* - Backspace/Delete: Special handling at item boundaries
*/
const listItemKeymap: $useKeymap;Inline HTML content preservation.
/**
* HTML attributes for HTML nodes
*/
const htmlAttr: $nodeAttr<'html'>;
/**
* Schema for inline HTML nodes with value attribute
*/
const htmlSchema: $nodeSchema<'html'>;Usage Examples:
import {
bulletListSchema,
wrapInBulletListCommand,
sinkListItemCommand
} from "@milkdown/preset-commonmark";
// Create nested list structure
editor.action((ctx) => {
const wrapCmd = ctx.get(wrapInBulletListCommand.key);
const sinkCmd = ctx.get(sinkListItemCommand.key);
wrapCmd(); // Create bullet list
sinkCmd(); // Indent current item
});