3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-19 14:45:44 +01:00

5b1: report the line a paragraph's kept text starts on, and stream the source lines

This commit is contained in:
2026-09-03 17:24:46 +02:00
parent b47aa17263
commit faedfa59c3
5 changed files with 36 additions and 18 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ for (const name of pairedNames(normalizationRoot, '.md', '.json')) {
})
}
// The position the input itself gives an offset: undefined where the offset starts no line.
// The position the input itself gives an offset, recomputed rather than trusted from the parser.
function lineStarting(markdown: string, offset: number): { line: number; offset: number } | undefined {
const before = markdown.slice(0, offset)
if (offset !== 0 && !/(?:\r\n|[\n\r])$/.test(before)) return undefined