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

Write the same plain markdown for documents the editor holds equal: normalize the reduction's input again, naming a refusal by the caller's document

This commit is contained in:
2026-10-03 14:32:34 +02:00
parent 48fd4e5940
commit 8958eab08e
4 changed files with 28 additions and 6 deletions
@@ -338,3 +338,9 @@ test('keeps the nodes the plain flavour spells and degrades only what it cannot'
const reduced = reduceToPlain(document(node('panel', { localId: '01a0d99b-1f56-7a50-889a-f4375f09ee05', panelType: 'info' }, said('x')), tasks))
assert.deepEqual(reduced.ok ? reduced.value : undefined, document(node('panel', { panelType: 'info' }, said('x')), { content: [node('taskItem', { state: 'DONE' }, text('t'))], type: 'taskList' }))
})
test('writes what the editor-normal form of the document writes', () => {
assert.equal(plain({ attrs: { order: -0 }, content: [{ content: [], type: 'listItem' }], type: 'orderedList' }), '0.\n')
assert.equal(plain({ content: [], text: 'hi', type: 'futureInline' }), 'hi\n')
assert.equal(plain(paragraph({ marks: [{ attrs: {}, type: 'code' }], text: 'a', type: 'text' }, { marks: [{ type: 'code' }], text: '|b', type: 'text' })), '`a|b`\n')
})