mirror of
https://github.com/larvit/adf-codec.git
synced 2026-11-13 12:18:28 +01:00
13 lines
620 B
TypeScript
13 lines
620 B
TypeScript
import type { AdfNode } from '../adf/document.ts'
|
|
import { identicalMarks, isSpellableText, nodeMarks } from '../adf/document.ts'
|
|
import { spellInlineLeafDirective } from './directive/syntax.ts'
|
|
|
|
export const textBreakName = 'textBreak'
|
|
|
|
export const textBreakSpelling = spellInlineLeafDirective(textBreakName, '')
|
|
|
|
// The lossless reader's rule: CommonMark reads the pair back as one text run (spec/flavour.md, Inline nodes).
|
|
export function joinsWhenRead(previous: AdfNode, node: AdfNode): boolean {
|
|
return isSpellableText(previous) && isSpellableText(node) && identicalMarks(nodeMarks(previous), nodeMarks(node))
|
|
}
|