3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-21 07:32:58 +01:00

Split adfToPlainText's step, node and emit helpers out of its writer

This commit is contained in:
2026-11-14 21:31:26 +01:00
committed by Lillem4n
parent 0507a49579
commit d5935c6ac0
2 changed files with 74 additions and 74 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import type { AdfDocument, AdfMark, AdfNode } from '../adf/document.ts'
import type { AdfAttributes, AdfDocument, AdfMark, AdfNode } from '../adf/document.ts'
import type { Result } from '../result.ts'
import { adfToHtml, adfToPlainText } from '../index.ts'
import { largestNesting } from '../nesting.ts'
@@ -319,7 +319,7 @@ test('writes the images of a group and an inline image on the line they stand in
})
test('writes a card as its address, or as its name then its address', () => {
const card = (attrs: Record<string, unknown>): AdfNode => ({ attrs, type: 'blockCard' })
const card = (attrs: AdfAttributes): AdfNode => ({ attrs, type: 'blockCard' })
assert.equal(shown(card({ url: 'https://example.com/spec' })), 'Before\n\nhttps://example.com/spec\n\nAfter')
assert.equal(shown(card({ data: { name: 'Design spec' }, url: 'https://example.com/spec' })), 'Before\n\nhttps://example.com/spec\n\nAfter')
assert.equal(shown(card({ data: { name: 'Design spec' } })), 'Before\n\nDesign spec\n\nAfter')