mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-12 11:48:29 +01:00
Answer prose round 2: the message names the value's type, rewrap the errors paragraph, one of the three
This commit is contained in:
+3
-2
@@ -64,8 +64,9 @@ Markdown the spelling table leaves alone, which `0.2.0` reads as a different doc
|
||||
|
||||
`unspellable-character`, `unspellable-line-start` and `unspellable-link` leave `ConvertErrorCode`
|
||||
and `not-a-string` joins it: a `switch` naming one of the three stops compiling, and one naming
|
||||
every code needs the new case. A document `adfToMarkdown` refused with one of them now
|
||||
converts; markdown the parser refused with one of them now refuses with the code the table gives.
|
||||
every code needs the new case. A document `adfToMarkdown` refused with one of the three now
|
||||
converts; markdown the parser refused with one of the three now refuses with the code the table
|
||||
gives.
|
||||
|
||||
| Input | `0.1.0` | `0.2.0` |
|
||||
| --- | --- | --- |
|
||||
|
||||
@@ -166,10 +166,10 @@ carries it opaquely and restores it unchanged ([`docs/decisions.md`](https://git
|
||||
stable across minors and safe to `switch` on exhaustively with no `default`; `message` is free text
|
||||
and may change in any release. A parse always names a position, so `markdownToAdf` and
|
||||
`plainMarkdownToAdf` return `ParseError`, whose `position` reads without a guard; an emit reads no
|
||||
source and carries `path` alone; one handler typed on `ConvertError` takes both, which is what the composed `markdownToHtml`
|
||||
and `htmlToMarkdown` hand back. `path` is the node's place from the document root, alternating
|
||||
`'content'` and an index, so `path.map((step) => '/' + step).join('')` is a JSON Pointer at the
|
||||
node — the empty path being the document itself.
|
||||
source and carries `path` alone; one handler typed on `ConvertError` takes both, which is what the
|
||||
composed `markdownToHtml` and `htmlToMarkdown` hand back. `path` is the node's place from the
|
||||
document root, alternating `'content'` and an index, so `path.map((step) => '/' + step).join('')`
|
||||
is a JSON Pointer at the node — the empty path being the document itself.
|
||||
|
||||
A call reports the first refusal in document order and stops, so a document with several surfaces
|
||||
them one per call. Every refusal is deterministic — there is no I/O anywhere — so a retry returns
|
||||
@@ -186,7 +186,7 @@ Parsing — `markdownToAdf` and `plainMarkdownToAdf`, and `htmlToAdf` at `0.2.0`
|
||||
| --- | --- | --- |
|
||||
| `malformed-directive` | an `!adf:` the grammar cannot read — a prefix completing no directive, an unclosed container, `[content]` or `{attrs}`, a closer with no container of its name open, a leaf given a body, `{attrs}` out of order or duplicated, invalid JSON in an opaque carry | write the spelling the message names, or keep it literal: escape the prefix — `\!adf:`, block and inline alike — or, for a code fence whose info string opens `adf:`, drop the info string and wrap the fence in `!adf:codeBlock {language="adf:…"}` |
|
||||
| `malformed-pipe-table` | a pipe row that is no pipe table — a missing or ragged `---` delimiter row, an alignment colon in it, or a row not opening with a pipe | open every row with a pipe and give the delimiter row the header's cell count; to keep the lines literal text instead, escape the leading pipe of every one — escaping a single row leaves the next to open a fresh table and fail the same way |
|
||||
| `not-a-string` | the value handed in is not a string, such as `null`, a number or a `String` object | pass the input as a string, `String(value)` for a `String` object; the message names the value's `typeof` |
|
||||
| `not-a-string` | the value handed in is not a string, such as `null`, a number or a `String` object | pass the input as a string, `String(value)` for a `String` object; the message names the value's type |
|
||||
| `unknown-directive-name` | a directive whose name is no node or mark this version spells | check the name in `spec/flavour.md`, or escape the prefix as `\!adf:`; the spelling itself is well formed, so a later minor may give the name meaning |
|
||||
| `unmappable-html` | the input holds an HTML construct the documented element set does not map, a comment and a processing instruction among them — at this version that is every raw HTML construct in markdown, the element set landing at `0.2.0` | remove the construct, or write what it holds in the lossless flavour |
|
||||
| `unmappable-image` | an image sits inside other content that is not another image's description, or carries a title | give the image a paragraph of its own and drop the title |
|
||||
|
||||
Reference in New Issue
Block a user