mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-19 14:45:44 +01:00
Answer stability round 1: tryImage drops an exit the comparison already takes, the README and changelog scope the linked image, and item 101 files the refusal naming its spelling
This commit is contained in:
+3
-2
@@ -59,8 +59,9 @@
|
|||||||
- **Breaking:** a link reference definition between two list items, after a blank line and at the
|
- **Breaking:** a link reference definition between two list items, after a blank line and at the
|
||||||
list's own indentation, ends the list, as CommonMark reads it; `0.1.0` read one list. See
|
list's own indentation, ends the list, as CommonMark reads it; `0.1.0` read one list. See
|
||||||
`MIGRATION.md`.
|
`MIGRATION.md`.
|
||||||
- **Breaking:** `adfToLosslessMarkdown` writes an external image only a link marks as
|
- **Breaking:** `adfToLosslessMarkdown` writes a centered, uncaptioned external image whose one
|
||||||
`[](href)`. Convert stored markdown per `MIGRATION.md`.
|
mark is a link holding only `href` and `title` as `[](href "title")`. Convert stored
|
||||||
|
markdown per `MIGRATION.md`.
|
||||||
- Fix the time `adfToLosslessMarkdown` and `adfToPortableMarkdown` take on text holding a long run of
|
- Fix the time `adfToLosslessMarkdown` and `adfToPortableMarkdown` take on text holding a long run of
|
||||||
`*`, `_`, `~` or backticks, or a heading ending in a long run of `#`: the time is linear in the
|
`*`, `_`, `~` or backticks, or a heading ending in a long run of `#`: the time is linear in the
|
||||||
run, and a run of 20000 `*` takes milliseconds where it took seconds.
|
run, and a run of 20000 `*` takes milliseconds where it took seconds.
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ saving what this pair read replaces mentions, attachments and macros with text.
|
|||||||
| `decisionList` | a bullet list | — |
|
| `decisionList` | a bullet list | — |
|
||||||
| `mention`, `status`, `emoji`, `date` | their text: `@` kept, a mention with none `@` and its id, an emoji its `shortName` without, a date `2026-09-13` in UTC | — |
|
| `mention`, `status`, `emoji`, `date` | their text: `@` kept, a mention with none `@` and its id, an emoji its `shortName` without, a date `2026-09-13` in UTC | — |
|
||||||
| `inlineCard`, `blockCard`, `embedCard` | a link to the card's URL, else its name | — |
|
| `inlineCard`, `blockCard`, `embedCard` | a link to the card's URL, else its name | — |
|
||||||
| external `media` | `` in a block, `[](href)` where a link marks it, `[alt](url)` inline | — |
|
| external `media` | in a block ``, or `[](href)` where a link marks it; inline `[alt](url)` | — |
|
||||||
| stored `media`, `mediaInline`, `extension`, `inlineExtension` | their `alt` or `text` | — |
|
| stored `media`, `mediaInline`, `extension`, `inlineExtension` | their `alt` or `text` | — |
|
||||||
| `layoutSection`, `bodiedExtension`, `bodiedSyncBlock`, `multiBodiedExtension`, `extensionFrame`, `caption`, a node this version does not know | its blocks or its text | — |
|
| `layoutSection`, `bodiedExtension`, `bodiedSyncBlock`, `multiBodiedExtension`, `extensionFrame`, `caption`, a node this version does not know | its blocks or its text | — |
|
||||||
| `placeholder` | nothing | — |
|
| `placeholder` | nothing | — |
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ export function tryImage(node: AdfNode): string | undefined {
|
|||||||
if (typeof url !== 'string' || (alt !== undefined && typeof alt !== 'string')) return undefined
|
if (typeof url !== 'string' || (alt !== undefined && typeof alt !== 'string')) return undefined
|
||||||
const [mark] = nodeMarks(media)
|
const [mark] = nodeMarks(media)
|
||||||
const link = mark === undefined ? undefined : linkDefinition(nodeAttrs(mark))
|
const link = mark === undefined ? undefined : linkDefinition(nodeAttrs(mark))
|
||||||
if (mark !== undefined && link === undefined) return undefined
|
|
||||||
const read = centeredImage([externalMedia(alt ?? '', url, link)])
|
const read = centeredImage([externalMedia(alt ?? '', url, link)])
|
||||||
return serializeCanonicalJson(node, 'compact') === serializeCanonicalJson(read, 'compact') ? tryImageLine(alt, url, link) : undefined
|
return serializeCanonicalJson(node, 'compact') === serializeCanonicalJson(read, 'compact') ? tryImageLine(alt, url, link) : undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ export function tryPipeCell(nodes: readonly AdfNode[], path: ConvertErrorPath, f
|
|||||||
return emitted.value.line
|
return emitted.value.line
|
||||||
}
|
}
|
||||||
|
|
||||||
// `link` wraps the image as the link's whole text: `[](href)`.
|
|
||||||
export function tryImageLine(alt: string | undefined, url: string, link?: LinkDefinition): string | undefined {
|
export function tryImageLine(alt: string | undefined, url: string, link?: LinkDefinition): string | undefined {
|
||||||
if (alt !== undefined && (/^[ \t]|[ \t]$|[\n\r]/.test(alt) || holdsNullCharacter(alt))) return undefined
|
if (alt !== undefined && (/^[ \t]|[ \t]$|[\n\r]/.test(alt) || holdsNullCharacter(alt))) return undefined
|
||||||
const destination = spellDestination(url)
|
const destination = spellDestination(url)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
`Bar = 9`
|
`Bar = 9`
|
||||||
|
|
||||||
`Next ID = 101`
|
`Next ID = 102`
|
||||||
|
|
||||||
| Goal | W |
|
| Goal | W |
|
||||||
|---|---|
|
|---|---|
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
| 59 | 0.2.1 | decision | **Group the directive grammar into `src/markdown/directive/`, move `Read<T>` to `result.ts`, and move `Flavour` and `flavourClaims` to `markdown/flavour.ts`.** | 3 | 5 | 2 | 6 | 2 | 10.4 |
|
| 59 | 0.2.1 | decision | **Group the directive grammar into `src/markdown/directive/`, move `Read<T>` to `result.ts`, and move `Flavour` and `flavourClaims` to `markdown/flavour.ts`.** | 3 | 5 | 2 | 6 | 2 | 10.4 |
|
||||||
| 62 | 0.2.1 | decision | **Move the portable flavour's reading out of `parse/` and its writing out of `emit/` into `markdown/portable/`, so `emit/` no longer imports `portable/`.** | 4 | 5 | 2 | 6 | 2 | 9.4 |
|
| 62 | 0.2.1 | decision | **Move the portable flavour's reading out of `parse/` and its writing out of `emit/` into `markdown/portable/`, so `emit/` no longer imports `portable/`.** | 4 | 5 | 2 | 6 | 2 | 9.4 |
|
||||||
| 96 | 0.2.1 | defect | **Read and write a text holding many unclosed backtick runs, or many `<!--`, `<?`, `<](href "title")` none is named.
|
||||||
|
|
||||||
### 92. Lower the reading cost of the files a chunk reads most before its first commit.
|
### 92. Lower the reading cost of the files a chunk reads most before its first commit.
|
||||||
|
|
||||||
The last five chunks' median is 168135 new input tokens before their first commit, the five before
|
The last five chunks' median is 168135 new input tokens before their first commit, the five before
|
||||||
|
|||||||
Reference in New Issue
Block a user