npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@voithos-labs/aragonite

v0.11.5

Published

cute svelte-based markdown editor lib with actual rich markdown editing

Downloads

760

Readme

npm license CI

Made for Limestone Notes (source), by Voithos Labs.

This project is an effort (perhaps in vain) to create a markdown editor that is both open source and not crap. In my book, this means that it has to be lossless, extensible, fast, have a graceful ui/ux, and have a hella good plugin interface. So you know, just some simplistic and easy to achieve goals [^1] [^2].

Note that aragonite is a work in progress [^3]. It's written in typescript and svelte [^4] [^5] [^6] [^7] (but usable in react, vue or plain js), and tested on chrome, edge, safari and firefox [^8].

What does it look like? Amazing of course:

For those of you who don't want to sit through a monologue, here's how to use the editor:

Embed

  1. install the package
npm install @voithos-labs/aragonite
  1. embed the editor
<script>
	import { Editor } from '@voithos-labs/aragonite/svelte';
	import '@voithos-labs/aragonite/styles/editor-theme.css';

	let editor;
	const source =
		'> That is not dead which can eternal lie,\n> And with strange aeons even death may die.\n';
</script>

<Editor bind:this={editor} {source} theme="light" />

(theme should match your page, since the editor paints no background of its own. dark is the default, btw.)

To save the source, just do something like:

<button onclick={() => save(editor.getSource())}>Save</button>

(obviously define the save function)

Not on svelte? There's @voithos-labs/aragonite-react and @voithos-labs/aragonite-vue, plus createEditor for plain js. The consumer guide has a snippet for each.

Demo

To try the demo, you can run it locally:

git clone https://github.com/voithos-labs/aragonite.git
cd aragonite
npm install
npm run dev

Or simply go to aragonite.dev


For more info go read consumer-guide.

Now, for those who don't have better things to do.

Origin

It began one afternoon when I realized Obsidian wasn't open source.

Ok, actually, nothing so dramatic. The short of it is, two years ago, two dumbasses (Finn and I) decided to make a better Obsidian. We wanted to retain the benefits of Obsidian - store notes in local folders, have a good plugin platform, and use open note formats like .md so users aren't locked in; at the same time we also wanted to combine the benefits of Notion's ui/ux. Also, of course, open source what we create. The editor library itself became aragonite, and the app became limestone, the companion codebase to aragonite. In our naivety, we figured making such an editor would be easy. It's not, not by a long shot.

Lossless

Why make aragonite lossless? What a stupid question, but let me answer it anyways. The philosophy is that you own your files (in limestone), but a traditional approach to parsing/serializing (e.g. tree as truth) doesn't always grant you that. Most editors normalize the data to their document model on load and on save, and sometimes serialize(parse(source)) !== source - that's not good. What you really want here is an underlying robustness; an architecture that takes round trip losslessness as one of its core promises, while still leaving enough room for extensibility and raw speed.

How do other editors deal with this? Broadly, three camps. Notion doesn't care, the truth is its proprietary block model, and markdown is an export format. The rich text camp (the ProseMirror markdown lineage: Tiptap, Milkdown, and friends) parses markdown into a rich node tree, treats that tree as the truth, and serializes by walking it. Open a file, change nothing, save, and the diff can be non-empty; the markdown layers built on top are import/export converters, and their own docs list what they drop. And then there's Obsidian, which genuinely is lossless, because its editor is a raw text buffer (CodeMirror 6) wearing syntax hiding decorations. The document model is the string; a fine answer for losslessness, a limiting one for everything else (more on that in Extensible). Aragonite is a bit more ambitious in its design: I want the byte honesty of a text buffer and a real document model at the same time.

So here's the promise: serialize(parse(source)) === source[^9]. For any input, the parser is total (a line with unknown syntax is still absorbed as paragraph text), and there are guards in place to keep things honest, including a test that throws piles of randomly generated documents at that exact round trip.

To start the design, then, you need a tree [^10] to act as the document model. Given the lossless promise, a natural selection would be a concrete syntax tree (CST). But what, exactly, should be the shape for this CST? Well, let's imagine the simplest approach: parse the source into a tree whose nodes each hold their own slice of the original text. Naturally, you'd render the slices as styled DOM, and save by concatenating the slices back together. So serialization might be something quite simple:

interface Serializable {
	prefix: string;
	children: { leadingTrivia: string; raw: string }[];
	suffix: string;
}

export function concatChildren(children: { leadingTrivia: string; raw: string }[]): string {
	let out = '';
	for (const c of children) out += c.leadingTrivia + c.raw;
	return out;
}

export function serialize(document: Serializable): string {
	return document.prefix + concatChildren(document.children) + document.suffix;
}

(leading trivia, prefix, and suffix would of course preserve the whitespace in the original document.)

But what about nested structures, like quote blocks and lists? Let's again imagine a simplistic approach: a container's raw holds its entire subtree's source, and its children each hold their own slices of the inner content. Concretely,

> Hello
> World

parses to a blockquote whose raw is the full two lines (> prefixes and all), while its single paragraph child holds a raw of Hello\nWorld, no > . Parsing a container is just strip-and-recurse: strip the markers off each line, parse what's left with the same algorithm, keep the original unstripped lines as the container's raw.

That's it, actually. That's the basic shape of the document model for aragonite:

flowchart LR
    MD["raw markdown"] -->|parse| CST["CST: every node<br/>holds its slice of the bytes"]
    CST -->|render| DOM["styled editable blocks"]
    CST -->|"serialize = concatenation"| MD

Congrats, you came up with the gist of the architecture.

Surely this approach wouldn't work? You are thinking. For one, this model means that parents redundantly store their children's contents. Yes, that is certainly true. But look at what the redundancy buys: serialize never recurses. A container's raw already contains its entire subtree's source, so serialization concatenates the top-level children and stops. Nesting depth is never part of the equation, and a function that small has nowhere for a bug to hide. Oh, btw, that code snippet above is src/lib/core/serializer.ts, the whole file, verbatim [^11]. That is really how this editor saves your documents.

And, also importantly:

  1. Syntax the parser doesn't understand will still round-trip losslessly (including syntax from a plugin you have since uninstalled)
  2. The worst case for a parser bug is bad styling, not a corrupted file
  3. Partial syntax is handled for free: a half-typed **bold is just a string in someone's raw, not an invalid tree state every keystroke has to worry about
  4. Saving rewrites nothing you didn't touch, so a git diff (or your sync tool, or a merge) sees exactly your edit, never a whole file re-serialization [^9]
  5. This will be explained in depth later, but this architecture meshes well with the block editor model, which opens a whole range of possibilities, including windowing and a naturally more capable plugin system

Reading what I told you, you might think to yourself: surely complex operations need a rich tree to operate on. They do not. Aragonite proves this to you, that semantic editing never needed the tree to be the truth; it only needs the tree to know where things are.

And the cost is just some memory and some bookkeeping. Memory: a parent stores its children's bytes again, roughly one extra copy per nesting level. Typical markdown doesn't nest deeply, so this stays small; you have to go looking for the pathological case (a line buried under hundreds of nested quotes) to make it hurt. Bookkeeping: an edit inside a container has to rebuild every enclosing container's raw on the way out, or the redundant copies drift apart. What that costs tracks how much text the surrounding containers hold, not how deep you nested: in an ordinary document it is microseconds, and it only grows into something you could feel when a single quote or list holds megabytes.

So indeed, it's a surprisingly robust design to achieve the lossless promise. And this, in short, is why aragonite made the design trade-off to store redundantly and get a range of benefits in exchange.

Extensible

What constitutes a good plugin system? In my book, three things. Reach: a plugin can teach the editor genuinely new things (new syntax, new blocks, new behavior) and the result feels native rather than bolted on. Safety: a plugin cannot cost you your document. Ergonomics: the API is typed, discoverable, and testable, so writing a plugin feels like writing a component, not like spelunking. Most editors manage one of these, maybe two.

Time to survey the field again. Notion has no plugin system in the editor at all; you can automate it over their rest api, but you cannot teach its editor a new kind of block. Obsidian has a real plugin system with an enormous ecosystem, but its document model is a string, which has implications; rendering custom syntax means building it twice, a markdown post processor for reading view plus a CodeMirror extension for live preview, and their own docs warn that "building editor extensions can be challenging, so before you start building one, consider whether you really need it". The ProseMirror lineage has the strongest structural story, custom content nests as real children inside the one document tree, but it rides on tree as truth and inherits the serialization problem from the last section.

| | Notion | Obsidian | ProseMirror lineage | aragonite | | --------------------------------- | ------------------------------ | -------------------------------- | --------------------------------- | -------------------------------------------- | | document model | proprietary blocks | a string (CM6 buffer) | rich node tree | CST of blocks | | how plugins extend the editor | they don't (external REST API) | CM6 extensions + post processors | node types + views + plugin state | own a kind: descriptor + component + grammar | | custom content, editable in place | no | mostly read-only previews | yes (contentDOM) | yes (real nested blocks) | | round trips your bytes | no, export is a translation | yes, it is the bytes | no, the serializer decides | yes, serialize reads raw only | | a plugin can break your file | n/a | nothing structural stops it | a schema/serializer bug can | only through its own kind's raw rebuild |

When plugins cannot own structure, everything collapses into the same two primitives: decorations (annotate text you don't own) and plugin-local state (a slot you re-map through every edit). Useful primitives, and aragonite ships the first one too. But a system built on only those two can decorate a document; it cannot really extend one. That is the box the flat model puts you in.

A CST of blocks changes the arithmetic. Every construct is a node with a kind, and the block editor model gives every node its own rendering surface, so the natural plugin unit falls out by itself: own a kind. A plugin declares a kind, then wires up to three things:

declare a kind ──┬─▶ descriptor   how it merges, focuses, serializes; its keymap
                 ├─▶ component    how it renders and hosts any editable content
                 └─▶ grammar      how source becomes the kind: a block opener,
                                  a :::name directive, or an inline recognizer

That kind is a first class citizen of the same tree and the same registries the built ins use; a paragraph and your callout ride identical machinery. Registration follows the customElements model: process global, register once (and, in case you are wondering, a duplicate throws instead of silently overriding someone else). And because the editor continuously parses raw markdown, typing the syntax is the input rule. Other editors need a whole subsystem to turn typed syntax into structure; here the parser was already watching.

What separates this from an embed system is that plugin content is genuinely editable. A container kind hosts real CST children in the same nested block list the built-in blockquote uses, so selection, merge, undo, and cross block everything work inside your callout without you or your plugin lifting a finger.

[!NOTE] In addition, 1: a leaf kind gets a text surface with native caret, IME, and undo parity. 2: an inline kind renders as an atomic widget that can reveal its raw source for editing when the caret walks into it. 3: the design every editor eventually reaches for and regrets, nesting a second editor whose state serializes as an opaque blob, is rejected here permanently (since a parallel source of truth cannot round-trip byte for byte).

Ofc, for everything that owns no syntax (spellcheck squiggles, ghost text, comment pins, etc.), aragonite also has decorations.



Note what is "missing" here: a plugin state API. That is on purpose. Elsewhere, plugin state exists mostly to hold a decoration set and remap it through every edit, because a position is an integer into one flat sequence and goes stale the moment someone types above it. An aragonite position is a path plus an offset into a tree rederived from raw on every edit, so there is nothing to re-map [^12]. A plugin that wants state keeps its own map keyed on the editor's id, and the platform stores nothing.

Circling back to the lossless promise - turns out that also helps here as a safety property (i.e. a plugin has no accidental path to corrupting your file):

  1. serialization reads raw and nothing else
  2. every node a plugin reads is readonly on its bytes at compile time
  3. mutation happens through commits the editor referees

The one deliberate byte write a plugin makes is its own kind's raw rebuild, which the commit ceremony hands an owned node precisely because that is when a byte write is legal. So the blast radius of a plugin bug is its own syntax rather than your whole document, and it is one function you can test - which is what the published testing seam drives round trips over.

A plugin component that throws takes down its own block, which degrades to a readable fallback while its siblings keep working. Uninstall a plugin and every document written with it still round trips byte for byte, because unknown syntax is handled gracefully.

Also, shipping a kind forces the boring questions up front: the registration type requires declaring how the kind behaves under all nine cross-cutting subsystems (round-tripping, focus, merge, selection, search, reordering, undo, clipboard, and how the fuzzer drives it), and registering enrolls it in a conformance battery: the headless half runs in your own test suite, the browser half in this repo's e2e sweep.

This is the bet. Aragonite can't top Obsidian on plugin count (not in the short term, anyway), so it's trading count for quality. Against my three criteria: reach is the own-a-kind story above, and safety is the lossless promise pulling double duty. Ergonomics is the one I haven't argued yet: typescript end to end, one import path for the whole authoring surface (@voithos-labs/aragonite/plugin, plus /svelte if you draw your views in svelte, or the react and vue packages' helpers if you draw them in those), and a public testing seam so your plugin's tests aren't an afterthought.

Does the design actually work in practice? Well, the ten bundled first party plugins (admonitions, details, footnotes, emoji, math, diagrams, table of contents, occurrence highlighting, slash commands, and a party parrot) are built on the exact surface third parties get, so I would describe it as "so far, so good".

Fast

Aragonite is fast, and its this way due to one main reason: the editor only mounts what you can see. A 10KB note and a 10MB document have the same number of live components on screen, so typing costs the same in both. This is, as people call it, windowing, and is also one of the reasons why the block editor model earned its keep.

In regards to large documents (how an editor fare with 10KB vs 10MB docs), most editors either solved this long ago, or made peace with the lack of ability to deal with it. On the "I have a solution" side, we have editors like CodeMirror 6, which renders only the visible viewport plus a margin while tracking heights for the whole document (this is a big part of why Obsidian holds up on large files). On the other side, we have the editors who threw in the towel. A long Notion page is thousands of block records, users start noticing lag around a thousand blocks, and the community's standing advice is to hide content inside toggles so less of it loads. The ProseMirror lineage mounts the entire document into one contenteditable, and unmounting the middle of a live editing surface breaks selection, IME, and everything else that already makes contenteditable cranky, so virtualization there remains an open forum thread rather than a feature.

On the second other side, aragonite's block model windows for real: blocks outside the viewport genuinely unmount [^13]. This is only possible because every block is its own editing surface; you cannot unmount the middle of one big contenteditable, but you can unmount nine thousand small ones. The rendered slice sits between two spacers sized by a height model, so the native scrollbar, scroll position, and scroll range are all real.


  • Every container windows its own children, meaning a checklist of 10000 items windows itself instead of mounting its whole subtree
  • Windowing self-activates per scope past a height budget
  • Heights come from a cheap per-kind estimate, corrected by real measurement once a block mounts
  • Any operation that needs an off screen block, say undo landing the caret five thousand blocks away or search jumping to the next match, reveals its target first: scroll the window, mount, then act

A keystroke, then, roughly goes through this process: the edited block re-reads its own bytes and rebuilds its styled spans (proportional to that one block, with a fast path for plain text), the ancestry rebuild (mentioned in the Lossless section, if you remember), an undo snapshot that shares every node with the live tree and copies only on write, and a reactive flush over roughly a viewport's worth of components. Nothing in that loop reads the whole document. In big O terms:

| operation | cost | | --------------------------- | ------------------------------------------------------------------ | | a keystroke | O(viewport) | | loading a document | O(document), duh | | saving | O(document bytes), because its basically a top level concatenation | | pushing an undo snapshot | O(top-level blocks), snapshots share nodes, copy on write | | finding the slice on scroll | O(log blocks) | | select all, then copy | O(selection) |


Model. Fix a document $s$ of $N$ bytes, parsed into $B$ block nodes, of which $B_t$ are top level. Let $\mathcal{C}$ be its set of container nodes (the nodes holding children) and $D_{\max}$ its maximum container nesting depth. An edit site sits at nesting depth $D \le D_{\max}$, inside a block whose content is $L$ bytes long; write $S_1 \le S_2 \le \dots \le S_D$ for the source sizes of its enclosing containers, innermost first. Let $V$ be the number of mounted blocks: the visible slice, a constant overscan band, and the focused block when it lies outside the slice. Windowing gives $V = O(\text{viewport})$, independent of $N$ and $B$. Costs are counted in a unit-cost RAM model, with string concatenation linear in the bytes it copies. The set of registered block openers is a constant of the grammar, not of the document.

Proposition 1 (serialization). Serialization computes $\mathit{prefix} + \sum_{i=1}^{B_t} (\mathit{trivia}_i + \mathit{raw}_i) + \mathit{suffix}$ in $\Theta(N + B_t) = \Theta(N)$ time, copying each output byte exactly once. No recursion is required: a container's $\mathit{raw}$ contains the source of its entire subtree, so the top-level pass reaches every byte.

Proposition 2 (parsing). The block parser is a single line-oriented scan. Each line is offered to a constant-size, priority-ordered list of openers, and strip-and-recurse re-scans a line once per enclosing container, so parsing costs

$$\Theta\left(\sum_{\ell \in \text{lines}} |\ell| \cdot (1 + d(\ell))\right)$$

where $d(\ell)$ is the nesting depth of line $\ell$. Flat documents parse in $\Theta(N)$; the worst case is $O(N \cdot D_{\max})$, attained only by deep towers of nested quotes. Inline parsing does not contribute: it is deferred per block and performed at render time, so a block that never mounts never incurs it.

Definition (ancestry rebuild). Because each container stores its subtree's source, an edit at depth $D$ must rewrite the $\mathit{raw}$ of every enclosing container. Rebuilding all of them from their children costs

$$A = \Theta\left(\sum_{i=1}^{D} S_i\right) \subseteq O(D \cdot S_D),$$

and when each level contributes $b$ bytes of its own source ($S_i = \Theta(i \cdot b)$), $A = \Theta(D^2 b)$. Top-level edits have $A = 0$. Measured, the full rebuild is linear in the lines it walks and independent of depth: on prose-length lines it costs approximately 0.075 µs per line (about 1.3 µs per KB) when the chain is unchanged, and approximately 1.4 times that after an edit, since the lines between the first and last change are rewritten rather than retained. $D = 8$ with 50 KB of prose per level costs approximately 3.8 ms unchanged and 5.0 ms after a one-line edit. Long lines cost less per byte, as the walk is per line.

Lemma (incremental rebuild). Each container records the offsets at which its children's bytes sit inside its own source. A keystroke therefore rewrites only the changed child's region at each level and shifts the offsets of the siblings that follow it, which costs $\Theta(\lvert c_i \rvert + n_i)$ per level for a changed child of $\lvert c_i \rvert$ bytes among $n_i$ siblings. Denote the sum over the enclosing levels by $A_{\text{type}}$. Structural edits (split, merge, paste, reorder, and deletion across blocks) do not take this path and pay $A$ in full.

Theorem (keystroke cost). A steady-state keystroke in a block of content length $L$ costs

$$\Theta(L + V) + A_{\text{type}}.$$

The $\Theta(L)$ term is the read-back of the edited block from the DOM, its inline reparse, and the rebuild of its styled spans; content with no inline syntax takes a fast path whose scan allocates nothing. The $\Theta(V)$ term is the reactive flush over the mounted components, which dominates in steady state. The undo snapshot is excluded from the steady state: consecutive keystrokes in one block share a single history entry, which ends on a 250 ms pause, a change of block, or a structural edit, so only the first keystroke of a run pays the snapshot cost of Proposition 3. Since $V$ is bounded by the viewport and $A_{\text{type}}$ vanishes at the top level, steady-state typing is $O(\text{viewport})$, independent of document size; this is the property the performance gate enforces. The degenerate case is $L = \Theta(N)$, a single paragraph holding the entire file, in which the span rebuild is $\Theta(N)$ by definition. It is transient, since any split restores $L \ll N$.

Proposition 3 (structural edits and history). A history snapshot shares every node with the live tree under an epoch mark, and copy-on-write duplicates only the spine actually written. Split, merge, and delete at the top level therefore cost $\Theta(B_t + L)$: the $B_t$ term is pointer-array work (the snapshot's copy of the top-level reference array, plus the id and reference splices), and no node is deep-cloned. At depth, the cost is $\Theta(B_t + P) + A$, where $P = \sum_{i=1}^{D} c_i$ and $c_i$ is the child count of the $i$-th container on the written spine, one shallow copy per level. The history thus holds the live tree plus the written spines, never stack-depth many copies: a push is $\Theta(B_t)$, not $\Theta(B)$, and a restore is a pointer swap of the same order.

Two further passes accompany every structural edit, and every undo and redo, outside the history itself. The map of link reference definitions is re-collected by a $\Theta(B)$ walk over all nodes, since the edit may have added or removed a definition; the walk reads no bytes, and measures between a few milliseconds and approximately 25 ms on the 10 MB fixtures. When the edit changes the set of blocks in a windowed list of $n$ blocks, that list's height table is rebuilt from block ids in $\Theta(n \log n)$. Ordinary keystrokes perform neither pass. For reference, on the 10 MB flat-prose fixture a structural edit measures approximately 110 ms at the median and a keystroke approximately 3 ms.

Proposition 4 (rendering and scroll queries). Mounting is $\Theta(V)$. Everything outside the mounted slice is represented by two spacer elements, sized from a Fenwick tree over per-block heights (one per windowed list), which answers offset-to-index and index-to-offset queries in $O(\log B)$ and absorbs a height correction in $O(\log B)$.

Proposition 5 (load). Load is the one axis windowing does not bound. The parser materializes all $B$ nodes up front (windowing limits what mounts, not what exists), so load is the parse of Proposition 2 plus per-node work. That work is not uniform across nodes: a container assigns its children's block ids only when its component mounts, and a height table is built only for a list that windows. Load therefore scales with the number of blocks in the lists that are actually built, chiefly the top level and any list on screen, rather than with the byte count or the total node count. The 10 MB fixtures, which share a byte budget, show this: the document of 392k top-level paragraphs loads slowest (approximately 1.8 s), a single list of 271k items follows (approximately 1.75 s), and the nested-containers document, with more nodes in total (586k) spread across many small containers, loads in approximately 1 s. At realistic sizes, load is well under a second.

Boundary case (reference definitions). Changing a link reference definition alters the rendering of every link that uses it, which is the closest the system comes to an $O(N)$ edit. The rendering cost remains $\Theta(V)$ eagerly: a counter that changes exactly when the set of definitions changes forms part of the render key of each block containing a [, so only mounted blocks re-render immediately, and the remainder is paid lazily as blocks mount. A keystroke inside a definition does, however, pay the $\Theta(B)$ definition walk of Proposition 3 eagerly. Every other edit is confined to the blocks it changes.

Remark (space). Materialized container source costs space. Define the amplification factor

$$\alpha = \frac{1}{N} \sum_{c \in \mathcal{C}} \lvert \mathit{raw}(c) \rvert,$$

the bytes containers store a second time, relative to the document. Measured, $\alpha = 3.55$ on the nested-containers fixture and $1.96$ on the table-heavy one, and the commit gate holds both under ceilings with approximately ×1.1 headroom. These are fixture measurements rather than a bound: the nesting cap limits node count, not materialized bytes, so a single line under 511 nested quotes reaches $\alpha \approx 511$. The space does not buy an asymptotic improvement, since a serializer that derived container source on demand would still be $\Theta(N)$. It determines where the risk lies: serialization remains a non-recursive concatenation (Proposition 1), and every consumer of bytes (a save, a clipboard slice, an undo restore) reads stored bytes rather than re-deriving them. Deriving container source from children would remove the inexpensive problem (space) and return the expensive one (round-trip correctness) to the serializer.

Summary. Serialization is $\Theta(N)$, as is parsing on flat documents, rising to $O(N \cdot D_{\max})$ only under pathological nesting. A steady-state keystroke is $\Theta(L + V) + A_{\text{type}}$, which is $O(\text{viewport})$ except inside large containers, where each enclosing level adds its changed child's bytes and a pass over its child offsets. Structural edits add $\Theta(B_t)$ history work, the full rebuild $A$ at depth, and a $\Theta(B)$ walk of the definition map. Load is the parse plus per-node work proportional to the lists actually built. The mechanisms behind each term, and the gates that hold them, are described in performance.md and the design documents it links.


Two things though. Loading is O(document), because ofc it is (the tree is materialized up front, which is sub-second at realistic sizes and multi-second only out at the hundreds of thousands of blocks extreme). And a single giant paragraph is O(itself) to edit: windowing windows blocks, not the inside of one block, so the span rebuild scales with paragraph length. This one, though, is transient, a single enter splits it into windowed blocks, and you only meet it by pasting a multi megabyte blob into one block [^14].

Now let me show you some pretty graphs.

Recorded 2026-10-22 on an ordinary desktop (Ryzen 7 7700, 31 GB RAM, Windows 11), on the production build the gate measures (npm run perf:check builds, previews, and times that), so read everything relative to that machine. What is gated versus report-only, and where the numbers live, is performance.md's subject. [^15]

Now, the numbers here depend on the machine; however, the scale of the numbers and the shape of the graph should tell you the story I want to share.

Graceful

Now, here's a conundrum Finn and I faced early on: we wanted Notion's uiux, but we (by we, I meant Finn) wanted a document, not a pile of blocks. In summary, we wanted the benefits of Notion's uiux in our uiux, not necessarily its look. Which is why even though under the hood aragonite is as much a block editor as Notion is, on the surface it reads like a document you are writing, not a fucking game of tetris.

Notion never lets you forget you are in a builder. Hover any block, a plain paragraph included, and a drag grip and a plus button fade into the gutter; the surface is a scaffold, and a stray click + drag can rearrange the page. Obsidian sits at the other pole, and reads as a calm plain document, because under the hood it is one (a text buffer, with all of the limitations I mentioned before). Aragonite wants the best of both world: the calm surface and a real structure.

So, if you open aragonite, the blocks are there, mostly invisible. No card chrome, no per block outline, and prose never grows a handle. The blocks you would pick up whole (a table, a picture, a code block, a list item, a divider) get one on hover, and you turn that off easily (blockDragHandles={false}); keyboard reorder is always available and shows nothing until you use it.

Oh, live preview? You think I forgot about it? nah. By default, markdown syntax stays visible but dimmed. Aragonite provide the presentationMode prop, which dials the same document along a spectrum, from the raw side to the rendered side:

  • source (default): styled source, every marker visible and dimmed. The editing substrate.
  • reading: markers hidden, widgets rendered, read-only. The closest to a classic rendered preview.
  • preview-block: live editing, but an unfocused block hides its syntax and the focused one reveals it. Markers appear only around where you are working.
  • preview-inline: the finest grain. Within the focused block, a construct's markers stay hidden until your caret actually enters it, then fold away again as you leave.
  • live: the rendered end of the spectrum that is still editable. Markers stay hidden even under the caret, and you edit the document as it looks.

Check out some screenshots of the actual app:

One last snarky remark to make... All these - all five styles, follow one render path. There is never a second rendering, never a derived raw tree, never a rich text model swapped in behind the scenes. I never exactly planned for inline preview or live mode, it just so happened that I valued the right promises and made the right decisions that made features like this buildable.

License

Aragonite is free software, released under MPL-2.0: use it, study it, fork it, embed it in whatever you're building, closed source included. The one string attached: if you change aragonite's own files, you share those changes under the same license.

Footnote

[^1]: read docs/changelog.md to experience my suffering.

[^2]: this is not even the first iteration of this editor; this is like my fourth try to write this piece of lovely shit.

[^3]: as steam users call it: in early access

[^4]: the superior frontend framework

[^5]: one day i might port this to react, one day

[^6]: angular users - sorry, i thought those don't exist anymore

[^7]: what does vue have that svelte and react don't have? a lower barrier to entry?

[^8]: this is, what you might call, a large bug surface... if you see something weird, be a homie and click that "report a bug" button on aragonite.dev

[^9]: Parse then serialize returns the same text every time. Editing is close - surrounding regions and the line you edit keep their spelling, bar a couple of tracked edge cases.

[^10]: A flat model is rejected because of the constraints it places on the plugin system. Read the Extensible section to understand why this is.

[^11]: yes, the real file has readonly in a few places and carries two comments. no, not going to include them.

[^12]: ProseMirror friends: yes, this means no StateField. The forward-mapping problem it solves is downstream of positions being integers into a flat sequence. Ours aren't.

[^13]: before anyone suggests it: CSS content-visibility is not this. It skips paint and layout but leaves the components mounted, and the cost that matters here is script, not layout.

[^14]: don't you dare try it lol

[^15]: the nine shapes, each generated from a fixed seed at 100 KB, 1 MB, and 10 MB: flat prose, nested containers (lists four deep plus nested quotes), many small blocks (392k four-word paragraphs at 10 MB), a single giant paragraph, reference-heavy prose (links plus their definitions), many small tables, one giant list, one giant blockquote, and one giant table. Each chart's band is the nine minus its own villain: the giant paragraph for keystrokes, many small blocks for load.