From 419bbcb4f2bad3e4c61794643c813d3a726d8540 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 3 Oct 2026 15:04:44 +0200 Subject: [PATCH] Say equality is deep over the document's JSON values --- README.md | 6 +++--- docs/decisions.md | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1b2a592..e14b29a 100644 --- a/README.md +++ b/README.md @@ -204,9 +204,9 @@ emit refuses: Serves Goals 1, 3 and 4. -- `markdownToAdf(adfToMarkdown(doc))` deep-equals `doc` — every key and value as `doc` holds it, - adjacent text nodes, an empty `attrs`, `content` or `marks` and `-0` included, and unknown node - types carried opaquely +- `markdownToAdf(adfToMarkdown(doc))` deep-equals `doc` as JSON, for a document of plain objects + as `JSON.parse` builds them — every key and value as `doc` holds it, adjacent text nodes, an + empty `attrs`, `content` or `marks` and `-0` included, and unknown node types carried opaquely ([`docs/decisions.md`](https://gitea.larvit.se/larvit/adf-codec/src/branch/main/docs/decisions.md#unknown-nodes-ride-the-carry)). - Markdown this library reads, and markdown it writes, means what the CommonMark spec says; from `0.2.0`, well-formed HTML means what the HTML standard says, read or written. The bullets below diff --git a/docs/decisions.md b/docs/decisions.md index 38bea5b..0aab2e4 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -36,8 +36,10 @@ does not imply a spellable document; `corpus/commonmark-spec/exceptions.json` na 2026-08-24, deep 2026-10-03, the maintainer. Goal 1. Valid while a pipeline or a bot can build a shape the editor would not. -"Equals" is `assert.deepStrictEqual`: every key and value `doc` holds, two adjacent text nodes, an -empty `attrs`, `content` or `marks` and `-0` included, with no normalization on either side. +"Equals" is deep equality over the document's JSON values: `assert.deepStrictEqual` on plain +objects as `JSON.parse` builds them, since ADF is JSON. Every key and value `doc` holds counts, two +adjacent text nodes, an empty `attrs`, `content` or `marks` and `-0` included, with no +normalization on either side. CommonMark's spelling stays wherever a document holds none of those shapes. The plain reader builds what is written, as `markdownToAdf` does. Only the plain writer is lossy: its reduction reads and writes editor-normal ADF — adjacent text nodes of identical marks and no attributes