Answer the prose and product-owner reviews' first round
CI / gate (push) Successful in 41s
CI / publish (push) Has been skipped

This commit is contained in:
2026-10-02 17:39:25 +02:00
parent 94eaee6bae
commit cd2b573372
5 changed files with 29 additions and 24 deletions
+13 -11
View File
@@ -37,8 +37,9 @@ The most useful ADF conversion library available, by these goals in priority ord
## Audience
Application developers embedding the library, in four personas. All four rely on the guarantees below and on `code` being a closed list; none may
rely on an error message's wording, which is free text.
Application developers embedding the library, in four personas. All four rely on the guarantees
below and on `code` being a closed list; none may rely on an error message's wording, which is
free text.
- **Viewer/editor app** — shows a document, lets a human edit, posts it back. Relies on the
round-trip holding for whatever the site's editor wrote, unknown node types included, and on a
@@ -68,8 +69,9 @@ if (result.ok) {
}
```
Serves Goals 1 and 7. Pure functions, each taking a whole document and returning a whole result;
no I/O, no configuration.
Serves Goals 1, 2 and 7. Pure functions, each taking a whole document and returning a whole
result; no I/O, no configuration. Every conversion goes through ADF, so `markdownToHtml` keeps
exactly what ADF holds.
```ts
adfToMarkdown(doc: AdfDocument): Result<string>
@@ -143,8 +145,8 @@ read replaces mentions, attachments and macros with text.
## The errors
Serves Goal 1. An ADF node type this version does not know is not an error: the lossless pair carries it opaquely
and restores it unchanged ([`docs/decisions.md`](https://gitea.larvit.se/larvit/adf-codec/src/branch/main/docs/decisions.md#unknown-nodes-ride-the-carry)).
Serves Goal 1. An ADF node type this version does not know is not an error: the lossless pair
carries it opaquely and restores it unchanged ([`docs/decisions.md`](https://gitea.larvit.se/larvit/adf-codec/src/branch/main/docs/decisions.md#unknown-nodes-ride-the-carry)).
`ConvertError` is `{ code, message, path, position? }`. `code` is the exported `ConvertErrorCode`,
stable across minors and safe to `switch` on exhaustively with no `default`; `message` is free text
@@ -197,11 +199,11 @@ emit refuses:
Serves Goals 1, 3 and 4.
- Markdown means what the CommonMark spec says, and well-formed HTML what the HTML standard
parses, both in what this library reads and in what a conforming parser reads from what it
writes; the bullets below name every exception.
- `markdownToAdf(adfToMarkdown(doc))` equals `doc` — unknown node types included, carried opaquely
([`docs/decisions.md`](https://gitea.larvit.se/larvit/adf-codec/src/branch/main/docs/decisions.md#unknown-nodes-ride-the-carry)).
- Markdown means what the CommonMark spec says — and, at `0.2.0`, well-formed HTML what the HTML
standard parses — both in what this library reads and in what a conforming parser reads back
from its output; the bullets below name every exception.
- Plain CommonMark is valid input to `markdownToAdf` apart from the raw HTML `unmappable-html`
names, with three carve-outs — literal text matching directive, pipe-table or strikethrough
syntax is claimed (escapable — `spec/flavour.md`) — and one gap: a CommonMark image fits only as
@@ -239,8 +241,8 @@ Serves Goals 1, 3 and 4.
## The package
Serves Goal 7. ESM only, no runtime dependencies, public npm. Built JavaScript with `.d.ts` beside it.
Pure ECMAScript at an ES2022 baseline, reaching for no host API; the test suite runs under Node,
Serves Goal 7. ESM only, no runtime dependencies, public npm. Built JavaScript with `.d.ts`
beside it. Pure ECMAScript at an ES2022 baseline, reaching for no host API; the test suite runs under Node,
Deno and Bun, and a headless Firefox converts the corpus through the built entrypoint.
Contract: [`docs/decisions.md`](https://gitea.larvit.se/larvit/adf-codec/src/branch/main/docs/decisions.md#any-es2022-engine), §Any
ES2022 engine to §Public on npm.