Say equality is deep over the document's JSON values
This commit is contained in:
@@ -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
|
||||
|
||||
+4
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user