3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 07:05:44 +01:00

Answer prose round 1: 0 🔴, 9 🟡; the retry paragraph, the guarantees, the changelog and the code-list entry each say one thing once, the engine-limit message names what it covers, the persona line excepts engine-limit by the maintainer's call, and the error row's split is filed as item 111

This commit is contained in:
2026-10-13 19:49:53 +02:00
committed by Lillem4n
parent d13a17565b
commit 667360f6e6
11 changed files with 46 additions and 40 deletions
+1 -2
View File
@@ -70,8 +70,7 @@ test('refuses text past V8\'s longest string', () => {
assert.equal(markdown(result), tooLong)
})
// One escape past the most entries V8's Set holds.
test('escapes more characters in a line than a Set holds', () => {
test('escapes more characters in a line than V8\'s Set holds', () => {
const stars = '*'.repeat(2 ** 24 + 1)
assert.equal(markdown(adfToLosslessMarkdown(document(paragraph({ text: stars, type: 'text' })))), `${'\\*'.repeat(2 ** 24 + 1)}\n`)
})
+1 -1
View File
@@ -123,7 +123,7 @@ export function commonMarkSpelling(node: AdfNode, path: ConvertErrorPath, depth:
return success(readable.value.spelling !== 'directive')
}
// Only an asked node's spelling is kept, and reading it drops it: the walk above spells the node into its own text, so no level of a subtree holds that text twice.
// Only an `asked` call keeps a spelling, and any read drops it: the ancestor that reads it spells it into its own text, so no two levels hold that text.
function readableBlock(node: AdfNode, path: ConvertErrorPath, depth: number, writing: Writing, caller: 'asked' | 'walked'): Result<EmittedBlock> | undefined {
const { memo } = writing
const kept = memo?.get(node)
+2 -2
View File
@@ -37,7 +37,7 @@ type Escapings = (index: number) => InlineEscaping | undefined
// Where a segment's first character landed in the output.
type PlacedSegment = { segment: InlineSegment; start: number }
// The run's escapable characters, or its characters before `end`.
// Which of a run's characters escape: every escapable one, or every one before `end`.
type RunEscapes = { end: number; escapable: false } | { escapable: true }
type EscapeWalk = {
@@ -111,7 +111,7 @@ function escape(segments: readonly InlineSegment[], container: LineContainer, cl
}
function backslashed(segments: readonly InlineSegment[], scan: string, escaped: Uint8Array): { output: string; placed: PlacedSegment[] } {
// Joined a few thousand pieces at a time: an array element per escape would cost more than the character it escapes.
// The output joins 4096 pieces at a time: an array element per escape would cost more than the character it escapes.
const chunks: string[] = []
let pieces: string[] = []
let from = 0