Skip to content

@liminis/editor

A Lexical-based markdown WYSIWYG editor that round-trips through mdast, with a host-injection seam so it can be embedded in an Electron app, a browser app, or anything else that can supply a message channel.

There is a live demo if you would rather see it than read about it. Everything below is documentation for building against the package.

Terminal window
npm install @liminis/editor

What you get

  • <Editor> — a WYSIWYG markdown editor. Tables, task lists, footnotes, definition lists, callouts, toggles, code blocks with Prism highlighting, images, LaTeX equations, Mermaid diagrams, C4 diagrams, YAML frontmatter and wiki-links.
  • A markdown pipelineparseMarkdown / stringifyMarkdown and the mdast ↔ Lexical mappers, usable with no editor mounted at all.
  • An annotation mechanism — range-anchored markers over document text that survive edits, configured per kind. Comments and corrections are not separate features; they are two configurations of one mechanism. Entirely opt-in: configure no kinds and none of it loads.
  • A host seam — every service the editor needs from its environment is an optional injected function with a safe default, so <Editor> renders in a host that supplies nothing.

Where the boundary falls

The single most useful thing to understand before building against this package is what it deliberately does not do. It has no storage, no file dialogs, no network, and no opinion about where a document came from.

That diagram is live — drag a box. It is rendered by @liminis/diagrams, the C4 renderer extracted from this editor, which the editor still depends on for the C4 diagrams it draws inside documents.

Reading order

PageAnswers
ArchitectureWhich entry point do I import, and what does each one cost me?
<Editor> and the host seamHow do I mount it, and what does the host have to supply?
The markdown pipelineWhat survives a round trip, and what does not?
AnnotationsHow do ranges stay anchored across edits?
Capability mapWhich capabilities are the editor’s, and which are a host’s?
ProvenanceWhere did this come from, and how do I read its ADR references?

The guide pages are the repository’s own docs/, rendered here. They ship inside the published tarball too, so the same text is in your node_modules.