API reference#

Exports grouped by entry point. @sigx/richtext v0.4.0 — the four packages share one version line.

@sigx/richtext#

Platform-free: runs on the web, on Lynx and in the terminal.

ExportKindDescription
Root, Paragraph, Heading, List, ListItem, Code, Link, Image, …typesThe mdast-shaped node types; PhrasingContentMap / BlockContentMap for augmentation
visit, map, SKIP, EXITfunctionsWalk or transform a tree
sliceSource, point, position, LineIndexfunctionsPositions and source slices
topKey, childKey, assignKeysfunctionsReconciliation keys
createSchema, standardNodes, standardSchemaschemaThe schema
NodeSpec, NodeRole, Schema, InlineFlatSpec, InlineFlat, InlineSpan, BlockMenuEntry, HtmlTagHinttypesSchema contracts
ATOM_CHAR, inlineAttrsOf, phrasingText, phrasingToText, paragraphOf, tableAlignhelpersFlat-model and text helpers
DocumentFormat, FormatParseOptions, FormatSerializeOptionstypesThe format contract
plainTextFormat, parsePlainText, serializePlainTextformatThe plain-text format
createLineEngine, createReparseEngine, IncrementalEngine, LineBlockParserstreamingIncremental engines
toJSON, fromJSON, CURRENT_VERSION, DocumentFormatError, RichTextDocumentsave formatSaving documents
createTextStream, TextStream, CreateTextStreamOptionsstreamingcreateTextStream
RichTextPlugin, PluginFormats, PlatformComponents, PlatformComponentMaptypesThe plugin contract
renderDocument, renderBlock, renderInline, collectEnv, missingComponents, RenderContextrenderThe render engine
ComponentMap, StandardComponents, PluginComponents, PluginComponent, RenderChild, NodeProps, HeadingProps, ListProps, ListItemProps, CodeProps, TableProps, TableRowProps, TableCellProps, LinkProps, ImageProps, LinkHandlertypesComponent-map contracts
sanitizeUrl, DEFAULT_SAFE_SCHEMES, UrlKindfunctionsURL allow-list
mentionNode, MentionpluginThe mention node and its spec
decodeEntities, decodeEntity, NAMED_ENTITIES, normalizeLabel, character classeshelpersText helpers formats build on

@sigx/richtext/dom#

ExportDescription
RichTextView, RichTextViewPropsThe web renderer
createDomComponents, defaultComponents, DomComponents, DomComponentsOptions, DomLinkHandlerThe default DOM component map
pluginDomComponentsMerge the components.dom of a plugin list
CodeBlock, CodeBlockPropsCode-block chrome (language label, copy button)
highlightedCodeBlock, HighlightedCodeBlockOptions, DEFAULT_DEBOUNCE_MSA code slot over any CodeHighlighter
CodeHighlighter, HighlightedToken, plainTokensThe highlighter contract
partAttrs, SCOPE, PartAttrsThe data-scope / data-part helpers

@sigx/richtext/editor#

ExportDescription
createEditor, Editor, EditorOptions, EditorListenerThe editor instance
EditorState, EditorSelection, TextSelection, BlockSelection, textSelection, blockSelection, createState, selectionRange, selectionEquals, …State and selections
Step, applyStep, invertStep, Transaction, transaction, applyTransaction, mapSelectionSteps and transactions
createHistory, History, HistoryOptionsUndo history
toFlat, toInline, sliceFlat, spliceFlat, concatFlat, marksAt, addMark, removeMark, toggleFlatMark, mergeAdjacent, flatEqualsThe flat inline model
commands (namespace), commandRegistry, chain, selectedBlockKeys, Command, CommandContext, CommandName, DispatchCommands
baseKeymap, resolveKeymap, runKeymap, keyName, normalizeKeyName, KeymapKeymap
InputRule, EnterRule, applyInputRules, applyEnterRules, triggerCharsInput rules
PasteData, pickPasteFormatPaste
toolbarState, defaultToolbarItems, ToolbarItem, ToolbarState, ToolbarContextToolbar items
createTriggerSessionManager, placeSuggestionPopup, TriggerSpec, TriggerItem, TriggerSession, TriggerSelectApiTrigger sessions
EditorPlugin, EditorPluginSlice, ClipboardWriter, editorSliceThe editor slice
createSlashPlugin, SlashPluginOptions, SlashItem, turnIntoCommand, filterMenuSlash commands
createMentionPlugin, MentionPluginOptions, MentionItemMentions
InlineSurface, CodeSurface, BoundaryKey, createInlineBridge, createCodeBridge, …Surface contracts

@sigx/richtext/editor/dom#

ExportDescription
RichTextEditor, RichTextEditorProps, RichTextEditorController, RichTextEditorChangeThe web block editor
BlockView, InlineBlock, CodeBlockEditorBlock components
standardContainerViews, defaultContainerView, ContainerViewContainer views
EditorToolbar, BlockMenu, SuggestionPopupChrome
createEditorView, useEditorViewThe view context
createDomInlineSurface, createDomCodeSurfaceThe DOM surfaces
renderInline, readInline, offsetToPoint, pointToOffset, caretClientRect, onEdgeLine, pointFromClient, …DOM mapping and caret helpers
createDomMentionPlugin, mentionChip, DomMentionOptionsMentions with a DOM chip
domEditorSlice, pluginAtomRenderers, pluginContainerViewsRead plugins' editor.dom slices
EDITOR_SCOPE, TOOLBAR_SCOPE, BLOCK_MENU_SCOPE, SUGGEST_SCOPE, editorPart, toolbarPart, blockMenuPart, suggestPartThe styling seam

@sigx/richtext/testing#

ExportDescription
strip, stripPositionsCompare trees structurally
feed, seededChunksDrive an engine in chunks
createFakeInlineSurface, createFakeCodeSurfaceFake surfaces for editor tests
runInlineSurfaceConformanceThe suite every inline surface passes

@sigx/richtext-markdown#

ExportDescription
markdownFormat, MarkdownFormatOptionsThe markdown format
parseMarkdown, parseBlocks, parseInline, toPlainText, normalizeSourceParser
createIncrementalEngine, IncrementalEngineOptionsStreaming parser
toMarkdown, ToMarkdownOptions, escapeTextSerializer
markdownNodes, markdownSchema, collectDefinitionsMarkdown node specs
MarkdownPluginSlice, InlineSyntaxExtension, BlockSyntaxExtension, SerializeRule, SerializeContext, …The markdown slice
resolveMarkdownPlugins, NO_MARKDOWN_PLUGINSMerge plugins' markdown slices
mentionPlugin, mentionMarkdown, mentionSyntax, serializeMention@[label](id) mentions

@sigx/richtext-markdown/editor: markdownPreset, markdownInputRules, markdownEnterRules.

@sigx/richtext-html#

ExportDescription
htmlFormat, HtmlFormatOptionsThe HTML format
parseHtml, ParseHtmlOptionsParser
toHtml, ToHtmlOptions, escapeHtml, normalizeUriSerializer
HtmlPluginSlice, HtmlElementRule, HtmlElementContext, HtmlSerializeRule, HtmlSerializeContextThe HTML slice
resolveHtmlPlugins, mentionHtmlPlugins
tokenize, buildTree, textOf, HtmlNode, HtmlElement, HtmlText, HtmlTokenTokenizer and tree

@sigx/richtext-html/editor: htmlPreset.

@sigx/richtext-shiki#

ExportDescription
shikiPlugin, ShikiPluginOptionsA plugin contributing the highlighted code slot
createShikiHighlighter, ShikiOptions, ShikiThemesThe highlighter on its own
DEFAULT_THEMES, DEFAULT_LANGSDefaults
ShikiModule, ShikiHighlighterLike, ShikiTokenLikeMinimal shiki shapes (no shiki types leak into the public .d.ts)