3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-15 21:10:25 +01:00

Keep a split tab's leftover columns as a number, so a cut under nested list items never copies the line

This commit is contained in:
2026-10-18 11:51:58 +02:00
committed by Lillem4n
parent ee89efea88
commit a140f5a244
5 changed files with 150 additions and 150 deletions
+2
View File
@@ -23,6 +23,8 @@
- Every reader takes time linear in the markdown when it holds blank lines under list items nested
deeply. Such a list is still refused as `unsupported-nesting-depth`, now after 40 ms where 20000
nested items and as many blank lines took 10.7 seconds.
- Every reader takes time linear in the markdown when it holds tab-indented lines under list items
nested deeply. 20 lines of 40000 tabs under 80000 nested items took 2.0 seconds, now 0.1.
- `losslessMarkdownToAdf` takes time linear in the markdown when an inline directive's `[content]`
holds many unclosed backtick runs: 640000 characters of them took one second, now 100 ms.
- The README compares the package with seven other ADF converters, each checked against its
+1 -2
View File
@@ -827,8 +827,7 @@ A cost fix that changes no behaviour lands on the suite staying green with no fi
changed, and a before-and-after figure in its PR; the gate times nothing. Measured and kept:
`adfDocumentFault`'s shape and depth walks stay two — the parting gives depth its own code — at
52 ms for a 9 MB document the emit takes 314 ms over. The 500-level guard runs after the block walk,
so it doesn't bound the walk's cost. Kept: where an item's width falls inside a tab, each level still
copies the whole line (`todo.md` item 120).
so it doesn't bound the walk's cost.
## Only the hard break holds a raw newline
+4
View File
@@ -432,3 +432,7 @@ Read most (opens and searches):
- `CHANGELOG.md` 1
- `docs/decisions.md` 1
- `package.json` 1
## Reading cost, chunk e2fa4a55bf5d, finished 2026-10-18T09:49:09Z
106412 new input tokens before the first commit.
+31 -24
View File
@@ -62,8 +62,10 @@ type ContainerStart = { kind: 'blockquote'; rest: Line } | { fresh: boolean; ind
type ParagraphLine = { position: SourcePosition; text: string }
// The line from an absolute column on: a tab a cut splits keeps the stop it is measured against.
type Line = { column: number; text: string }
// The line from an absolute column on: a tab a cut splits keeps the stop it is measured against, and its leftover columns
// stand as `spaces` before `text`, so a cut never builds a string. At most 3, which a cut of `largestOpenerIndentation` takes whole.
// They are blank, so blankness reads `text` alone; a block takes the line through `lineText`.
type Line = { column: number; spaces: number; text: string }
type LeafOpener = { index: number; position: SourcePosition }
@@ -103,7 +105,7 @@ export function parseBlocks(markdown: string, claims: Claims): ParsedBlocks {
}
for (const line of sourceLines(markdown)) {
walk.position = line.position
readLine(walk, { column: 0, text: line.text })
readLine(walk, { column: 0, spaces: 0, text: line.text })
}
closeContainers(walk, 0)
return { blocks: walk.blocks, definitions: walk.definitions }
@@ -153,7 +155,7 @@ function readLine(walk: Walk, line: Line): void {
const opened = openContainers(walk, matched.rest, paragraphOpen, matched.depth)
if (!opened.opened && matched.depth < walk.stack.open.length) {
if (continuesLazily(walk, opened.rest)) {
appendParagraph(walk, opened.rest.text)
appendParagraph(walk, lineText(opened.rest))
return
}
closeContainers(walk, matched.depth)
@@ -190,7 +192,7 @@ function matchBlankLine(walk: Walk, line: Line, from: number, quotesPassed: numb
const innermost = edges[last]?.container
const emptyItem = last >= from && innermost?.kind === 'item' && innermost.blocks.length === 0 && walk.leaf === undefined
const stop = Math.min(quoteEdges[quotesPassed] ?? edges.length, emptyItem ? last : edges.length)
return { depth: edges[stop]?.depth ?? walk.stack.open.length, rest: stop === from ? line : { column: line.column, text: '' } }
return { depth: edges[stop]?.depth ?? walk.stack.open.length, rest: stop === from ? line : { column: line.column, spaces: 0, text: '' } }
}
function continuesContainer(container: EdgeContainer, line: Line): Line | undefined {
@@ -200,12 +202,12 @@ function continuesContainer(container: EdgeContainer, line: Line): Line | undefi
function blockquoteRest(opener: Line): Line | undefined {
if (!opener.text.startsWith('>')) return undefined
return removeColumns({ column: opener.column + 1, text: opener.text.slice(1) }, 1)
return removeColumns({ column: opener.column + 1, spaces: 0, text: opener.text.slice(1) }, 1)
}
function openContainers(walk: Walk, line: Line, paragraphOpen: boolean, depth: number): { opened: boolean; rest: Line } {
const unmatched = walk.stack.open[depth]
const tail = thematicBreakTail(line.text)
const tail = thematicBreakTail(lineText(line))
let opened = false
let rest = line
while (leadingColumns(rest) < indentedCodeColumns) {
@@ -236,7 +238,7 @@ function containerStart(
function itemStart(line: Line, opener: Line, paragraphOpen: boolean, enclosing: OpenContainer | undefined, position: SourcePosition): ContainerStart | undefined {
const marker = listMarker(opener.text)
if (marker === undefined) return undefined
const after: Line = { column: opener.column + marker.width, text: opener.text.slice(marker.width) }
const after: Line = { column: opener.column + marker.width, spaces: 0, text: opener.text.slice(marker.width) }
const blank = isBlankLine(after.text)
if (paragraphOpen && !markerInterruptsParagraph(marker.start, blank)) return undefined
const spaces = leadingColumns(after)
@@ -379,7 +381,7 @@ function pushFault(walk: Walk, fault: ConvertFault): void {
function continuesLazily(walk: Walk, line: Line): boolean {
if (walk.leaf?.kind !== 'paragraph' || isBlankLine(line.text)) return false
if (leadingColumns(line) >= indentedCodeColumns) return true
const opener = removeColumns(line, largestOpenerIndentation).text
const opener = lineText(removeColumns(line, largestOpenerIndentation))
return !opensBlock(walk.claims, opener)
}
@@ -392,16 +394,16 @@ function opensBlock(claims: Claims, opener: string): boolean {
function readBlockLine(walk: Walk, line: Line): void {
const leaf = walk.leaf
if (leaf?.kind === 'fenced-code') {
if (closingCodeFence(removeColumns(line, largestOpenerIndentation).text, leaf.marker)) closeLeaf(walk)
else leaf.lines.push(removeColumns(line, leaf.indentation).text)
if (closingCodeFence(lineText(removeColumns(line, largestOpenerIndentation)), leaf.marker)) closeLeaf(walk)
else leaf.lines.push(lineText(removeColumns(line, leaf.indentation)))
return
}
if (leaf?.kind === 'html') {
if (leaf.closer === undefined ? isBlankLine(line.text) : leaf.closer.test(line.text)) closeLeaf(walk)
if (leaf.closer === undefined ? isBlankLine(line.text) : leaf.closer.test(lineText(line))) closeLeaf(walk)
return
}
if (leaf?.kind === 'pipe-table') {
const cells = leadingColumns(line) < indentedCodeColumns ? pipeTableRow(walk.claims, removeColumns(line, largestOpenerIndentation).text) : undefined
const cells = leadingColumns(line) < indentedCodeColumns ? pipeTableRow(walk.claims, lineText(removeColumns(line, largestOpenerIndentation))) : undefined
if (cells !== undefined) {
leaf.rows.push(cells)
return
@@ -417,7 +419,7 @@ function readBlockLine(walk: Walk, line: Line): void {
return
}
if (walk.leaf === undefined && leadingColumns(line) >= indentedCodeColumns) {
walk.leaf = { held: [], kind: 'indented-code', lines: [removeColumns(line, indentedCodeColumns).text], position: walk.position }
walk.leaf = { held: [], kind: 'indented-code', lines: [lineText(removeColumns(line, indentedCodeColumns))], position: walk.position }
return
}
openLeaf(walk, line)
@@ -425,18 +427,18 @@ function readBlockLine(walk: Walk, line: Line): void {
function readIndentedCodeLine(leaf: Extract<OpenLeaf, { kind: 'indented-code' }>, line: Line): boolean {
if (isBlankLine(line.text)) {
leaf.held.push(removeColumns(line, indentedCodeColumns).text)
leaf.held.push(lineText(removeColumns(line, indentedCodeColumns)))
return true
}
if (leadingColumns(line) < indentedCodeColumns) return false
for (const held of leaf.held) leaf.lines.push(held)
leaf.lines.push(removeColumns(line, indentedCodeColumns).text)
leaf.lines.push(lineText(removeColumns(line, indentedCodeColumns)))
leaf.held.length = 0
return true
}
function openLeaf(walk: Walk, line: Line): void {
const opener = removeColumns(line, largestOpenerIndentation).text
const opener = lineText(removeColumns(line, largestOpenerIndentation))
const directive = walk.claims.directives ? readDirectiveLine(opener) : undefined
if (directive !== undefined) {
closeLeaf(walk)
@@ -460,12 +462,12 @@ function openLeaf(walk: Walk, line: Line): void {
}
const html = openingHtmlBlock(opener, walk.leaf?.kind === 'paragraph')
if (html === undefined) {
appendParagraph(walk, line.text)
appendParagraph(walk, lineText(line))
return
}
closeLeaf(walk)
walk.leaf = { closer: html.closer, construct: html.construct, kind: 'html', position: walk.position }
if (html.closer?.test(line.text) === true) closeLeaf(walk)
if (html.closer?.test(lineText(line)) === true) closeLeaf(walk)
}
// A setext underline over a paragraph the definitions emptied is no heading: it opens the next block.
@@ -608,7 +610,7 @@ function sourceLine(markdown: string, line: number, start: number, end: number):
// `upTo` caps the cost: checking a line against an item's width reads at most that width.
function leadingColumns(line: Line, upTo = Infinity): number {
let columns = 0
let columns = line.spaces
for (const character of line.text) {
if (columns >= upTo) break
if (character === ' ') columns += 1
@@ -618,18 +620,23 @@ function leadingColumns(line: Line, upTo = Infinity): number {
return columns
}
// CommonMark's tab stops: a tab the cut splits gives the columns it holds past the cut back as spaces.
// CommonMark's tab stops: a tab the cut splits leaves the columns it holds past the cut as `spaces`.
function removeColumns(line: Line, columns: number): Line {
const target = line.column + columns
let column = line.column
if (line.spaces >= columns) return { column: target, spaces: line.spaces - columns, text: line.text }
let column = line.column + line.spaces
let index = 0
while (column < target && index < line.text.length) {
const character = line.text.charAt(index)
if (character !== ' ' && character !== '\t') break
const width = character === ' ' ? 1 : tabStop - (column % tabStop)
index += 1
if (column + width > target) return { column: target, text: ' '.repeat(column + width - target) + line.text.slice(index) }
if (column + width > target) return { column: target, spaces: column + width - target, text: line.text.slice(index) }
column += width
}
return { column, text: line.text.slice(index) }
return { column, spaces: 0, text: line.text.slice(index) }
}
function lineText(line: Line): string {
return line.spaces === 0 ? line.text : ' '.repeat(line.spaces) + line.text
}
+112 -124
View File
@@ -12,43 +12,42 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 120 | 0.3.0 | | defect | **Read a tab-indented line under nested list items in time linear in the line.** | 2 | 1 | 2 | 3 | 3 | 9 by 2 | 6.0 |
| 115 | 0.3.0 | | defect | **Build text holding no `border` mark in `losslessMarkdownToAdf`, and have `adfToLosslessMarkdown` carry text holding one.** | 2 | 1 | 2 | 3 | 3 | 4 by 3 | 4.5 |
| 100 | 0.3.0 | | decision | **Put the reading of an image's title as its caption back to a reader panel, now that a writer panel reads a title as hover text.** | 1 | 2 | 2 | 3 | 3 | 6 by 4 | 4.0 |
| 33 | 0.3.0 | | defect | **Emit a line in time linear in its mark runs, in `adfToLosslessMarkdown` and `adfToPortableMarkdown`.** | 3 | 1 | 2 | 4 | 5 | 9 by 3 | 3.6 |
| 109 | 0.3.0 | | defect | **Spell nested lists and quotes in time linear in the markdown.** | 3 | 1 | 2 | 4 | 5 | 9 by 3 | 3.6 |
| 95 | 0.3.0 | | decision | **Find the code-span closers an escape forms, the mark runs a line cannot spell and the text `[` that opens link text by reading the line back, in place of `escapeClosedRuns`, `unspellableRuns` and `lastLinkClose` predicting them.** | 4 | 1 | 3 | 6 | 6 | 10 by 7 | 1.2 |
| 91 | 0.3.0 | 95 | | **Spell an emphasis once across the code spans, an emphasis or link once across the hard breaks, dates, emoji, inline cards, mentions and statuses between two nodes it marks, and an emphasis across inline media, in both writers.** | 3 | 2 | 2 | 5 | 5 | 6 by 6 | 2.4 |
| 60 | 0.3.0 | | decision | **Collect the questions `parse/` asks `emit/` into one named module.** | 2 | 1 | 2 | 3 | 4 | 10 by 4 | 2.0 |
| 92 | 0.3.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 2 | 1 | 1 | 2 | 4 | 10 by 4 | 2.0 |
| 102 | 0.3.0 | | decision | **Place a block a portable task list refuses at its path in the returned document without replaying `splitTaskList` on stand-in nodes.** | 2 | 1 | 2 | 3 | 4 | 10 by 4 | 2.0 |
| 59 | 0.3.0 | | 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 | 1 | 2 | 4 | 5 | 10 by 5 | 1.5 |
| 62 | 0.3.0 | | 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/`.** | 3 | 1 | 2 | 4 | 5 | 10 by 5 | 1.5 |
| 73 | 0.3.0 | 33, 59, 60, 62, 91, 92, 95, 100, 102, 109, 115, 120 | | **Announce the package where someone needing an ADF converter already reads: JRACLOUD-77436, the Atlassian developer community and Stack Overflow's ADF-to-markdown questions.** | 1 | 2 | 2 | 3 | 2 | 3 by 8 | 32.0 |
| 81 | 0.4.0 | | | **Fail the gate unless the README's error tables list exactly the codes `ConvertErrorCode` holds.** | 1 | 1 | 1 | 1 | 2 | 3 by 2 | 8.0 |
| 45 | 0.4.0 | | defect | **Replace `isAdfDocument` with a reader returning `Result<AdfDocument>`.** | 2 | 1 | 3 | 4 | 3 | 1 by 2 | 6.0 |
| 100 | 0.3.0 | | decision | **Put the reading of an image's title as its caption back to a reader panel, now that a writer panel reads a title as hover text.** | 1 | 2 | 2 | 3 | 3 | 6 by 4 | 6.2 |
| 115 | 0.3.0 | | defect | **Build text holding no `border` mark in `losslessMarkdownToAdf`, and have `adfToLosslessMarkdown` carry text holding one.** | 2 | 1 | 2 | 3 | 3 | 4 by 3 | 4.8 |
| 60 | 0.3.0 | | decision | **Collect the questions `parse/` asks `emit/` into one named module.** | 2 | 1 | 2 | 3 | 4 | 10 by 4 | 4.0 |
| 92 | 0.3.0 | | | **Lower the reading cost of the files a chunk reads most before its first commit.** | 2 | 1 | 1 | 2 | 4 | 10 by 4 | 4.0 |
| 102 | 0.3.0 | | decision | **Place a block a portable task list refuses at its path in the returned document without replaying `splitTaskList` on stand-in nodes.** | 2 | 1 | 2 | 3 | 4 | 10 by 4 | 4.0 |
| 95 | 0.3.0 | | decision | **Find the code-span closers an escape forms, the mark runs a line cannot spell and the text `[` that opens link text by reading the line back, in place of `escapeClosedRuns`, `unspellableRuns` and `lastLinkClose` predicting them.** | 4 | 1 | 3 | 6 | 6 | 10 by 7 | 2.3 |
| 91 | 0.3.0 | 95 | | **Spell an emphasis once across the code spans, an emphasis or link once across the hard breaks, dates, emoji, inline cards, mentions and statuses between two nodes it marks, and an emphasis across inline media, in both writers.** | 3 | 2 | 2 | 5 | 5 | 6 by 6 | 3.7 |
| 59 | 0.3.0 | | 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 | 1 | 2 | 4 | 5 | 10 by 5 | 3.0 |
| 62 | 0.3.0 | | 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/`.** | 3 | 1 | 2 | 4 | 5 | 10 by 5 | 3.0 |
| 33 | 0.3.0 | | defect | **Emit a line in time linear in its mark runs, in `adfToLosslessMarkdown` and `adfToPortableMarkdown`.** | 3 | 1 | 2 | 4 | 5 | 9 by 3 | 2.0 |
| 109 | 0.3.0 | | defect | **Spell nested lists and quotes in time linear in the markdown.** | 3 | 1 | 2 | 4 | 5 | 9 by 3 | 2.0 |
| 73 | 0.3.0 | 33, 59, 60, 62, 91, 92, 95, 100, 102, 109, 115 | | **Announce the package where someone needing an ADF converter already reads: JRACLOUD-77436, the Atlassian developer community and Stack Overflow's ADF-to-markdown questions.** | 1 | 2 | 2 | 3 | 2 | 3 by 8 | 17.4 |
| 112 | 0.4.0 | | | **Pad a GFM pipe table's short rows with empty cells, read its body rows holding no pipe, and read a one-column table without leading pipes in `portableMarkdownToAdf`.** | 2 | 1 | 2 | 3 | 3 | 4 by 4 | 6.3 |
| 80 | 0.4.0 | | | **Name the node's path and the attribute key when `not-an-adf-document` refuses a node inside the document.** | 2 | 1 | 2 | 3 | 3 | 6 by 4 | 6.2 |
| 81 | 0.4.0 | | | **Fail the gate unless the README's error tables list exactly the codes `ConvertErrorCode` holds.** | 1 | 1 | 1 | 1 | 2 | 3 by 2 | 4.4 |
| 75 | 0.4.0 | | | **Make the generated-markdown property write block carries as `adf:` fences, canonical and hostile.** | 1 | 1 | 1 | 1 | 2 | 10 by 2 | 4.0 |
| 6 | 0.4.0 | | decision | **Specify the HTML dialect.** | 3 | 2 | 1 | 4 | 6 | | 0.0 |
| 7 | 0.4.0 | 6, 59, 60, 62 | decision | **Ship HTML: `adfToHtml`, `htmlToAdf`, and markdown to and from HTML composed through ADF, each call named by its flavour.** | 4 | 2 | 2 | 6 | 9 | 3 by 6 | 0.6 |
| 46 | 0.4.0 | 7 | | **Publish the bundle size in the README, failing the release pipeline when it drifts.** | 2 | 2 | 1 | 3 | 4 | 3 by 3 | 6.0 |
| 68 | 0.4.0 | | defect | **Carry a non-text inline node holding `content` or `text`, a block holding `text`, and a leaf block holding `content`.** | 2 | 1 | 2 | 3 | 3 | 1 by 2 | 6.0 |
| 112 | 0.4.0 | | | **Pad a GFM pipe table's short rows with empty cells, read its body rows holding no pipe, and read a one-column table without leading pipes in `portableMarkdownToAdf`.** | 2 | 1 | 2 | 3 | 3 | 4 by 4 | 6.0 |
| 80 | 0.4.0 | | | **Name the node's path and the attribute key when `not-an-adf-document` refuses a node inside the document.** | 2 | 1 | 2 | 3 | 3 | 6 by 4 | 4.0 |
| 51 | 0.4.0 | | | **Match a reference label to its definition under Unicode case folding.** | 2 | 1 | 2 | 3 | 4 | 4 by 2 | 2.0 |
| 75 | 0.4.0 | | | **Make the generated-markdown property write block carries as `adf:` fences, canonical and hostile.** | 1 | 1 | 1 | 1 | 2 | 10 by 2 | 2.0 |
| 7 | 0.4.0 | 6, 59, 60, 62 | decision | **Ship HTML: `adfToHtml`, `htmlToAdf`, and markdown to and from HTML composed through ADF, each call named by its flavour.** | 4 | 2 | 2 | 6 | 9 | 3 by 6 | 0.3 |
| 46 | 0.4.0 | 7 | | **Publish the bundle size in the README, failing the release pipeline when it drifts.** | 2 | 2 | 1 | 3 | 4 | 3 by 3 | 3.3 |
| 45 | 0.4.0 | | defect | **Replace `isAdfDocument` with a reader returning `Result<AdfDocument>`.** | 2 | 1 | 3 | 4 | 3 | 1 by 2 | 3.3 |
| 68 | 0.4.0 | | defect | **Carry a non-text inline node holding `content` or `text`, a block holding `text`, and a leaf block holding `content`.** | 2 | 1 | 2 | 3 | 3 | 1 by 2 | 3.3 |
| 51 | 0.4.0 | | | **Match a reference label to its definition under Unicode case folding.** | 2 | 1 | 2 | 3 | 4 | 4 by 2 | 2.1 |
| 77 | 0.4.0 | | decision | **Read the input once into a plain copy, so an accessor property or a throwing Proxy yields `not-an-adf-document` and every call returns a result.** | 3 | 1 | 3 | 5 | 4 | | 0.0 |
| 107 | 0.4.0 | | decision | **Spell the block carry's JSON so its length stays linear in the node's JSON.** | 3 | 1 | 3 | 5 | 5 | | 0.0 |
| 72 | 0.4.0 | 6, 7, 45, 46, 51, 68, 75, 77, 80, 81, 107, 112 | decision | **Re-create `gitea.larvit.se/larvit/adf-codec` as a read-only pull mirror of GitHub, its issues and Actions off and its description pointing at GitHub.** | 1 | 2 | 1 | 2 | 1 | 3 by 1 | 4.8 |
| 42 | 0.5.0 | | defect | **Trim a text leaf's trailing blanks in linear time.** | 1 | 1 | 2 | 2 | 2 | 9 by 3 | 12.0 |
| 38 | 0.5.0 | | defect | **Spell a lone surrogate in a text node so it survives a UTF-8 encode.** | 1 | 1 | 2 | 2 | 2 | 1 by 2 | 8.0 |
| 9 | 0.5.0 | | | **Ship an online sandbox: a web page with two textboxes converting between ADF and markdown on the library's browser build.** | 3 | 2 | 1 | 4 | 6 | 3 by 6 | 4.0 |
| 31 | 0.5.0 | | | **Make the branch-coverage figure repeat across runs of an unchanged tree.** | 2 | 1 | 1 | 2 | 3 | 10 by 3 | 2.2 |
| 57 | 0.5.0 | | | **Make each `ci.sh` leg build what it reads, so one leg run alone tests the current tree.** | 2 | 1 | 1 | 2 | 3 | 10 by 3 | 2.2 |
| 76 | 0.5.0 | | | **State the files the package does not ship once, so the build, the lint ceiling and the coverage exclusions cannot drift apart.** | 1 | 1 | 1 | 1 | 2 | 10 by 2 | 2.0 |
| 34 | 0.5.0 | | | **Read emphasis flanking by the whole character beside an astral symbol.** | 2 | 1 | 2 | 3 | 3 | 4 by 1 | 1.5 |
| 56 | 0.5.0 | | | **Give each piece of `blocks.ts`'s block-walk state and `inline-content.ts`'s `Scan` one owner that returns what it changes.** | 3 | 1 | 2 | 4 | 5 | 10 by 5 | 1.5 |
| 118 | 0.5.0 | | | **Spell a portable link's title through `oneLine`.** | 1 | 1 | 1 | 1 | 1 | 10 by 1 | 1.2 |
| 82 | 0.5.0 | | | **Give the directive tests and fixtures random UUID v7 ids in place of `a-1`, `a`, `x` and `h`.** | 2 | 1 | 1 | 2 | 3 | 10 by 1 | 0.8 |
| 58 | 0.5.0 | | | **Port `ci.sh`, `publish.sh` and `docker-runner.sh` to standalone Python scripts.** | 3 | 1 | 2 | 4 | 6 | 10 by 3 | 0.5 |
| 72 | 0.4.0 | 6, 7, 45, 46, 51, 68, 75, 77, 80, 81, 107, 112 | decision | **Re-create `gitea.larvit.se/larvit/adf-codec` as a read-only pull mirror of GitHub, its issues and Actions off and its description pointing at GitHub.** | 1 | 2 | 1 | 2 | 1 | 3 by 1 | 2.6 |
| 42 | 0.5.0 | | defect | **Trim a text leaf's trailing blanks in linear time.** | 1 | 1 | 2 | 2 | 2 | 9 by 3 | 6.5 |
| 31 | 0.5.0 | | | **Make the branch-coverage figure repeat across runs of an unchanged tree.** | 2 | 1 | 1 | 2 | 3 | 10 by 3 | 4.5 |
| 57 | 0.5.0 | | | **Make each `ci.sh` leg build what it reads, so one leg run alone tests the current tree.** | 2 | 1 | 1 | 2 | 3 | 10 by 3 | 4.5 |
| 38 | 0.5.0 | | defect | **Spell a lone surrogate in a text node so it survives a UTF-8 encode.** | 1 | 1 | 2 | 2 | 2 | 1 by 2 | 4.4 |
| 76 | 0.5.0 | | | **State the files the package does not ship once, so the build, the lint ceiling and the coverage exclusions cannot drift apart.** | 1 | 1 | 1 | 1 | 2 | 10 by 2 | 4.0 |
| 56 | 0.5.0 | | | **Give each piece of `blocks.ts`'s block-walk state and `inline-content.ts`'s `Scan` one owner that returns what it changes.** | 3 | 1 | 2 | 4 | 5 | 10 by 5 | 3.0 |
| 118 | 0.5.0 | | | **Spell a portable link's title through `oneLine`.** | 1 | 1 | 1 | 1 | 1 | 10 by 1 | 2.4 |
| 9 | 0.5.0 | | | **Ship an online sandbox: a web page with two textboxes converting between ADF and markdown on the library's browser build.** | 3 | 2 | 1 | 4 | 6 | 3 by 6 | 2.2 |
| 34 | 0.5.0 | | | **Read emphasis flanking by the whole character beside an astral symbol.** | 2 | 1 | 2 | 3 | 3 | 4 by 1 | 1.6 |
| 82 | 0.5.0 | | | **Give the directive tests and fixtures random UUID v7 ids in place of `a-1`, `a`, `x` and `h`.** | 2 | 1 | 1 | 2 | 3 | 10 by 1 | 1.5 |
| 58 | 0.5.0 | | | **Port `ci.sh`, `publish.sh` and `docker-runner.sh` to standalone Python scripts.** | 3 | 1 | 2 | 4 | 6 | 10 by 3 | 1.0 |
| 74 | 0.5.0 | | owner | **Keep the release path publishing after npm retires bypass-2FA tokens.** | 3 | 2 | 4 | 7 | 4 | | 0.0 |
| 8 | 0.6.0 | | owner | **Ship a CLI.** | 3 | 2 | 1 | 4 | 7 | | 0.0 |
@@ -58,16 +57,11 @@
## Details
### 120. Read a tab-indented line under nested list items in time linear in the line.
### 100. Put the reading of an image's title as its caption back to a reader panel, now that a writer panel reads a title as hover text.
`removeColumns` in `src/markdown/parse/blocks.ts` returns `' '.repeat(n) + line.text.slice(index)`
where an item's width ends inside a tab, a fresh string, so the next level's `slice` copies the
whole line instead of sharing it. Measured on 2026-10-18 on 20 tab-indented lines under 20000,
40000 and 80000 nested list items: 176, 460 and 1812 ms, where the same lines indented with spaces
took 73, 90 and 173 ms. Keep the split tab's leftover columns as a number on `Line` beside `column`
and `text`, so a cut never builds a string. Delete the clause naming this item from
`docs/decisions.md` §Cost fixes are measured, never timed. Found while reviewing item 98's chunk,
2026-10-18.
Every reader reads `![a](u "t")` as an image captioned `t` (`docs/decisions.md` §An image reads as an
image only alone in its paragraph, 3 of 3 on 2026-10-09). On 2026-10-11 a writer panel of the same
audience kept the captioned image's `!adf:caption` directive, 3 of 3, reading a title as hover text.
### 115. Build text holding no `border` mark in `losslessMarkdownToAdf`, and have `adfToLosslessMarkdown` carry text holding one.
@@ -77,28 +71,27 @@ and `text`, so a cut never builds a string. Delete the clause naming this item f
(`src/adf/inline-nodes.ts`) restricts text only when it is marked `code`. It changes how stored
markdown reads, so it ships in a minor. Found while building item 114, 2026-10-14.
### 100. Put the reading of an image's title as its caption back to a reader panel, now that a writer panel reads a title as hover text.
### 60. Collect the questions `parse/` asks `emit/` into one named module.
Every reader reads `![a](u "t")` as an image captioned `t` (`docs/decisions.md` §An image reads as an
image only alone in its paragraph, 3 of 3 on 2026-10-09). On 2026-10-11 a writer panel of the same
audience kept the captioned image's `!adf:caption` directive, 3 of 3, reading a title as hover text.
`parse/` asks `emit/` through `commonMarkSpelling` and `openingLinkTakesDirective`, each imported
from where it happens to live. One module naming the questions keeps `docs/decisions.md` §The source
parts by ADF and format true as they grow.
### 33. Emit a line in time linear in its mark runs, in `adfToLosslessMarkdown` and `adfToPortableMarkdown`.
### 92. Lower the reading cost of the files a chunk reads most before its first commit.
`adfToLosslessMarkdown` spends 28 s on one paragraph of 2000 × `un` plus `**-r**`: each run its
flanking cannot spell re-emits the whole line before riding the carry, quadratic in the runs, and
the portable reduction's `spellableLine` drops one mark per re-emit the same way. An inline node
whose attributes no spelling writes re-emits the line the same way before riding the carry. Make all
three linear.
The last five chunks' median is 113495 new input tokens before their first commit, the five before
them 93713. Files read most over the last five chunks, counting opens and searches: `todo.md` 28,
`README.md` 24, `docs/decisions.md` 11, `CHANGELOG.md` 8, `MIGRATION.md` 6,
`src/conformance/commonmark-spec.test.ts` 6, `src/markdown/portable/inline-reduction.ts` 6,
`spec/flavour.md` 5, `src/markdown/portable/adf-to-portable-markdown.test.ts` 5,
`src/markdown/parse/inline-content.ts` 4.
### 109. Spell nested lists and quotes in time linear in the markdown.
### 102. Place a block a portable task list refuses at its path in the returned document without replaying `splitTaskList` on stand-in nodes.
Each level of a nested list or quote re-indents its whole text, so the work is the depth times the
text. `losslessMarkdownToAdf` on 3 MB of lazy lines in a list nested 490 levels inside
`!adf:blockquote` spends about 5 seconds re-spelling it. 2 MB of the same lines, split over two
items of a list nested 480 levels, took 11 minutes to refuse on Node 24: a deep subtree past the
length bound refuses only once every level below has re-indented its text. The writers do the same
on such a document. Found while shipping item 106, 2026-10-11.
`splitPath` (`src/markdown/parse/markdown-to-adf.ts`) builds stand-ins and `splitPlace`
(`src/markdown/portable/task-list.ts`) finds them again by object identity, right only while
`taskOfParagraphs` keeps the original child objects. Both paired-ruling seats on 2026-10-11 named it
the reason the project read worse.
### 95. Find the code-span closers an escape forms, the mark runs a line cannot spell and the text `[` that opens link text by reading the line back, in place of `escapeClosedRuns`, `unspellableRuns` and `lastLinkClose` predicting them.
@@ -119,28 +112,6 @@ mention or code spelled `!adf:text{text=" "}`. Joining the run across the break
`inline-line.ts` ruled worse with two comprehension panels (PR #22): a joined run that cannot be spelled needs its own fallback,
first as a set of parted breaks, then as a flag the first fallback clears.
### 60. Collect the questions `parse/` asks `emit/` into one named module.
`parse/` asks `emit/` through `commonMarkSpelling` and `openingLinkTakesDirective`, each imported
from where it happens to live. One module naming the questions keeps `docs/decisions.md` §The source
parts by ADF and format true as they grow.
### 92. Lower the reading cost of the files a chunk reads most before its first commit.
The last five chunks' median is 113495 new input tokens before their first commit, the five before
them 93713. Files read most over the last five chunks, counting opens and searches: `todo.md` 35,
`README.md` 31, `docs/decisions.md` 19, `src/markdown/parse/markdown-to-adf.test.ts` 14,
`CHANGELOG.md` 11, `spec/flavour.md` 11, `src/markdown/emit/adf-to-markdown.test.ts` 8,
`src/markdown/parse/inline-content.ts` 7, `MIGRATION.md` 6,
`src/conformance/commonmark-spec.test.ts` 6.
### 102. Place a block a portable task list refuses at its path in the returned document without replaying `splitTaskList` on stand-in nodes.
`splitPath` (`src/markdown/parse/markdown-to-adf.ts`) builds stand-ins and `splitPlace`
(`src/markdown/portable/task-list.ts`) finds them again by object identity, right only while
`taskOfParagraphs` keeps the original child objects. Both paired-ruling seats on 2026-10-11 named it
the reason the project read worse.
### 59. Group the directive grammar into `src/markdown/directive/`, move `Read<T>` to `result.ts`, and move `Flavour` and `flavourClaims` to `markdown/flavour.ts`.
Eight directive files sit across three directories, and the `markdown/` root holds 14 entries. HTML
@@ -158,6 +129,23 @@ Writing: `spellPortableBlock`, `quotedUnder`, `tryTaskList` and `taskBlocks` in
`flavourClaims`. Every comprehension reader on 2026-10-03 named the portable flavour's spread across
three directories.
### 33. Emit a line in time linear in its mark runs, in `adfToLosslessMarkdown` and `adfToPortableMarkdown`.
`adfToLosslessMarkdown` spends 28 s on one paragraph of 2000 × `un` plus `**-r**`: each run its
flanking cannot spell re-emits the whole line before riding the carry, quadratic in the runs, and
the portable reduction's `spellableLine` drops one mark per re-emit the same way. An inline node
whose attributes no spelling writes re-emits the line the same way before riding the carry. Make all
three linear.
### 109. Spell nested lists and quotes in time linear in the markdown.
Each level of a nested list or quote re-indents its whole text, so the work is the depth times the
text. `losslessMarkdownToAdf` on 3 MB of lazy lines in a list nested 490 levels inside
`!adf:blockquote` spends about 5 seconds re-spelling it. 2 MB of the same lines, split over two
items of a list nested 480 levels, took 11 minutes to refuse on Node 24: a deep subtree past the
length bound refuses only once every level below has re-indented its text. The writers do the same
on such a document. Found while shipping item 106, 2026-10-11.
### 73. Announce the package where someone needing an ADF converter already reads: JRACLOUD-77436, the Atlassian developer community and Stack Overflow's ADF-to-markdown questions.
Blocked by every other `0.3.0` item (the maintainer, 2026-10-14): the posts announce the finished
@@ -167,18 +155,36 @@ posting, set `converter-comparison/run.sh`'s pins to each package's latest versi
its versions and its date in step with the output. We draft each post for the place it goes; the
maintainer posts them once `0.3.0` is published. Found while planning discoverability, 2026-10-04.
### 112. Pad a GFM pipe table's short rows with empty cells, read its body rows holding no pipe, and read a one-column table without leading pipes in `portableMarkdownToAdf`.
GFM pads a short row with empty cells, reads a line holding no `|` after a table as a row, and
reads `a |` over `--- |` as a one-column table. `portableMarkdownToAdf` refuses a short row as
`malformed-pipe-table`, ends the table at a line holding no `|`, and reads the one-column shape as a
paragraph. A long row stays refused (`docs/decisions.md` §The portable reader refuses what GFM's
reading would drop), so the README's pipe-table guarantee keeps the long row for both readers, and
the short row and the line holding no `|` for `losslessMarkdownToAdf` alone. The one-column shape needs `isBareDelimiterRow` in the writer's escaping to cover it too.
### 80. Name the node's path and the attribute key when `not-an-adf-document` refuses a node inside the document.
Lands with items 45 and 77, whose reader walks every node. Today every refused node, such as one
with a `Date` in an attribute, reads `an ADF document's content holds ADF nodes: one of them is not`
with an empty `path`. An export tool told this about one document in thousands then searches that
document's whole tree. Give the node's path, and name its type and the attribute key as
`attributeNestingMessage` does. Found by the product-owner review of items 66 and 67, 2026-10-05.
### 81. Fail the gate unless the README's error tables list exactly the codes `ConvertErrorCode` holds.
`src/result.test.ts` checks the union against the call sites only, so a code added or removed
leaves the README's tables a false contract under a green gate. Assert that the tables list exactly
the union. Found by the technical-principles audit of item 78, 2026-10-05.
### 45. Replace `isAdfDocument` with a reader returning `Result<AdfDocument>`.
### 75. Make the generated-markdown property write block carries as `adf:` fences, canonical and hostile.
Lands with item 77: the reader returns item 77's copy. Goal 1 has every call return a result; the
boolean guard is the one export that does not, and it cannot say which branch refused, where
`not-an-adf-document`'s message already does. Breaking: `MIGRATION.md` shows the guard's
replacement.
`blockCarry` and `hostileBlockCarry` (`src/conformance/markdown-property.test.ts`) write a fence
whose info string is `carry`. Under the `docs/decisions.md` entry "The carry fence names the node
type", that is an ordinary code language, so the property reaches `readCarriedBlock`'s refusals only
where a random edit lands in a canonical document. Write `adf:<type>` and `adf:` fences, canonical
and hostile. Technical principle: for pure logic over many inputs, prefer a property test, so the property must reach the fenced carry's refusals itself. Found by the technical-principles audit, 2026-10-04.
### 6. Specify the HTML dialect.
@@ -204,6 +210,13 @@ or report the unminified gzip). The figure lands in README §The package beside
dependencies" claim, and in a size column of the comparison table. Measured today,
unminified: tarball 60.4 kB, unpacked 221.5 kB, JS gzipped 45.6 kB.
### 45. Replace `isAdfDocument` with a reader returning `Result<AdfDocument>`.
Lands with item 77: the reader returns item 77's copy. Goal 1 has every call return a result; the
boolean guard is the one export that does not, and it cannot say which branch refused, where
`not-an-adf-document`'s message already does. Breaking: `MIGRATION.md` shows the guard's
replacement.
### 68. Carry a non-text inline node holding `content` or `text`, a block holding `text`, and a leaf block holding `content`.
`emitLeaf` (`emit/inline-line.ts`) and `emitDirectiveBlock` (`emit/adf-to-markdown.ts`)
@@ -212,23 +225,6 @@ round-trips them; `docs/decisions.md` §The code list gives a cause the carry an
them from the README's `unsupported-node-shape` cause "Writing, in `adfToLosslessMarkdown`". Found by the README-goals
audit, 2026-10-04.
### 112. Pad a GFM pipe table's short rows with empty cells, read its body rows holding no pipe, and read a one-column table without leading pipes in `portableMarkdownToAdf`.
GFM pads a short row with empty cells, reads a line holding no `|` after a table as a row, and
reads `a |` over `--- |` as a one-column table. `portableMarkdownToAdf` refuses a short row as
`malformed-pipe-table`, ends the table at a line holding no `|`, and reads the one-column shape as a
paragraph. A long row stays refused (`docs/decisions.md` §The portable reader refuses what GFM's
reading would drop), so the README's pipe-table guarantee keeps the long row for both readers, and
the short row and the line holding no `|` for `losslessMarkdownToAdf` alone. The one-column shape needs `isBareDelimiterRow` in the writer's escaping to cover it too.
### 80. Name the node's path and the attribute key when `not-an-adf-document` refuses a node inside the document.
Lands with items 45 and 77, whose reader walks every node. Today every refused node, such as one
with a `Date` in an attribute, reads `an ADF document's content holds ADF nodes: one of them is not`
with an empty `path`. An export tool told this about one document in thousands then searches that
document's whole tree. Give the node's path, and name its type and the attribute key as
`attributeNestingMessage` does. Found by the product-owner review of items 66 and 67, 2026-10-05.
### 51. Match a reference label to its definition under Unicode case folding.
`link-syntax.ts` normalizes a label with `toLowerCase`, so `[ẞ]` misses its `[SS]` definition (spec
@@ -238,14 +234,6 @@ as data per §Standards ship as data: lowercasing and then uppercasing would als
gains its row. Its `pending` exceptions go, and the README's guarantees drop the case-folding
exception and count one fewer.
### 75. Make the generated-markdown property write block carries as `adf:` fences, canonical and hostile.
`blockCarry` and `hostileBlockCarry` (`src/conformance/markdown-property.test.ts`) write a fence
whose info string is `carry`. Under the `docs/decisions.md` entry "The carry fence names the node
type", that is an ordinary code language, so the property reaches `readCarriedBlock`'s refusals only
where a random edit lands in a canonical document. Write `adf:<type>` and `adf:` fences, canonical
and hostile. Technical principle: for pure logic over many inputs, prefer a property test, so the property must reach the fenced carry's refusals itself. Found by the technical-principles audit, 2026-10-04.
### 77. Read the input once into a plain copy, so an accessor property or a throwing Proxy yields `not-an-adf-document` and every call returns a result.
Lands with item 45, in one chunk: item 45's reader returns the copy. The maintainer's call,
@@ -288,11 +276,6 @@ interim sentence.
quadratic in a run of blanks inside one leaf: a paragraph of `a`, 80 000 spaces, `b` takes 6.5 s in
`adfToPortableMarkdown`. Scan backward, as the expand title's trim does.
### 38. Spell a lone surrogate in a text node so it survives a UTF-8 encode.
`adfToLosslessMarkdown` emits it verbatim, so markdown stored as UTF-8 reads back U+FFFD; attribute
values already escape it.
### 31. Make the branch-coverage figure repeat across runs of an unchanged tree.
Three Node test legs over one unchanged tree reported `emit/inline-line.ts` at 95.83%, 96.23% and
@@ -310,6 +293,11 @@ Technical principle "Compose, do not entangle": Deno, Bun and the tests read the
`node_modules`, the floor and consumer legs the pack leg's, and the browser leg whatever `dist/` the
build leg left, so a leg run alone can pass on stale output.
### 38. Spell a lone surrogate in a text node so it survives a UTF-8 encode.
`adfToLosslessMarkdown` emits it verbatim, so markdown stored as UTF-8 reads back U+FFFD; attribute
values already escape it.
### 76. State the files the package does not ship once, so the build, the lint ceiling and the coverage exclusions cannot drift apart.
Technical principle DRY: the set is written in `tsconfig.build.json`'s `exclude`, `.oxlintrc.json`'s
@@ -318,13 +306,6 @@ assumes they agree. A helper added to one list lints test code under the shipped
shipped code from coverage, silently. Derive two from the third, or assert in a test that the three
agree. Found by the technical-principles audit, 2026-10-04.
### 34. Read emphasis flanking by the whole character beside an astral symbol.
Check whether `delimiterRunToken` (`inline-tokens.ts`), `emittedRuns` and `resolveEmphasis`
(`line-escaping.ts`) read one UTF-16 unit beside an astral symbol. A lone surrogate is neither
punctuation nor symbol, but CommonMark reads `😀` as punctuation. Where they do, read the code
point, with a fixture per direction.
### 56. Give each piece of `blocks.ts`'s block-walk state and `inline-content.ts`'s `Scan` one owner that returns what it changes.
Technical principle "One owner per value": the `Walk` record passes through functions that mutate it
@@ -346,6 +327,13 @@ for a module of its own.
hand, so a change to what a portable line drops would miss link titles. Technical principle: DRY.
Found by the principles audit of item 99, 2026-10-14.
### 34. Read emphasis flanking by the whole character beside an astral symbol.
Check whether `delimiterRunToken` (`inline-tokens.ts`), `emittedRuns` and `resolveEmphasis`
(`line-escaping.ts`) read one UTF-16 unit beside an astral symbol. A lone surrogate is neither
punctuation nor symbol, but CommonMark reads `😀` as punctuation. Where they do, read the code
point, with a fixture per direction.
### 82. Give the directive tests and fixtures random UUID v7 ids in place of `a-1`, `a`, `x` and `h`.
Technical principle: tests use random UUID v7 ids; `portable-markdown-to-adf.test.ts` already does.