diff --git a/src/markdown/parse/markdown-to-adf.test.ts b/src/markdown/parse/markdown-to-adf.test.ts index 108d852..fea1acb 100644 --- a/src/markdown/parse/markdown-to-adf.test.ts +++ b/src/markdown/parse/markdown-to-adf.test.ts @@ -95,6 +95,7 @@ test('refuses a value that is not a string, in both readers, at the start of the ok: false, }) } + assert.notStrictEqual(position(Reflect.apply(read, undefined, [null])), position(Reflect.apply(read, undefined, [null]))) } }) diff --git a/src/markdown/parse/markdown-to-adf.ts b/src/markdown/parse/markdown-to-adf.ts index 86149a0..216d9d7 100644 --- a/src/markdown/parse/markdown-to-adf.ts +++ b/src/markdown/parse/markdown-to-adf.ts @@ -26,7 +26,6 @@ type Paragraph = Extract // `inExpand` is whether an expand holds the blocks, which makes a folded callout a nestedExpand. type Reading = { carried: Set; definitions: LinkDefinitions; flavour: Flavour; inExpand: boolean; memo: SpellingMemo } -const documentStart: SourcePosition = { line: 1, offset: 0 } const imageAfterMarker = 'an image fits only as a paragraph of its own: this one continues the paragraph a marker opens, which a blank line before it ends' const imageOnMarkerLine = 'an image fits only as a paragraph of its own: this one shares a line with a marker' @@ -39,7 +38,7 @@ export function plainMarkdownToAdf(markdown: string): Result { - if (typeof markdown !== 'string') return positioned(failure('not-a-string', `markdown is a string: found ${typeName(markdown)}`, []), documentStart) + if (typeof markdown !== 'string') return positioned(failure('not-a-string', `markdown is a string: found ${typeName(markdown)}`, []), { line: 1, offset: 0 }) const parsed = parseBlocks(markdown) const [only] = parsed.blocks if (parsed.blocks.length === 1 && only?.kind === 'directive' && only.name === documentName) { @@ -47,7 +46,7 @@ function readDocument(markdown: string, flavour: Flavour): Result