diff --git a/spec/flavour.md b/spec/flavour.md index e80909b..83fa506 100644 --- a/spec/flavour.md +++ b/spec/flavour.md @@ -195,9 +195,9 @@ is the fence. ## Raw HTML in input CommonMark input may contain raw HTML. `markdownToAdf` routes each construct through the foreign -HTML element mapping (`docs/decisions.md` §Foreign HTML sorts three ways; specified with the HTML -dialect) — ADF has no raw-HTML node, so a construct without a mapping, comments and processing -instructions included, is an error result naming it. The flavour never emits raw HTML. +HTML element mapping (`docs/decisions.md` §Foreign HTML sorts three ways) — ADF has no raw-HTML +node, so a construct without a mapping, comments and processing instructions included, is an error +result naming it. The flavour never emits raw HTML. ## Block nodes diff --git a/src/markdown/emit/adf-to-markdown.ts b/src/markdown/emit/adf-to-markdown.ts index 35ed05c..03d2a9e 100644 --- a/src/markdown/emit/adf-to-markdown.ts +++ b/src/markdown/emit/adf-to-markdown.ts @@ -114,7 +114,7 @@ function readableBlock(node: AdfNode, path: ConvertErrorPath, depth: number, wri const kept = memo?.get(node) if (kept !== undefined) { if (kept.block === undefined) return undefined - // An entry holds the spelling at its fill depth: a read at or above it rebases headroom, a read below re-spells, since a hit skips the depth guards the walk runs. + // An entry holds the spelling at its fill depth. A read at or above it rebases headroom; a read below re-spells, because a hit skips the walk's depth guards. if (depth <= kept.depth) return success({ ...kept.block, headroom: kept.block.headroom + kept.depth - depth }) } const spelled = spellReadableBlock(node, path, depth, writing) diff --git a/src/markdown/emit/line-escaping.ts b/src/markdown/emit/line-escaping.ts index fa09f12..e7b39ae 100644 --- a/src/markdown/emit/line-escaping.ts +++ b/src/markdown/emit/line-escaping.ts @@ -121,10 +121,10 @@ function claimsHighlight(scan: string, index: number): boolean { return flanking.opens || flanking.closes } -// CommonMark reads no escape inside a code span, so a backtick string an escape forms or splits off still closes one an earlier bare run opens. +// CommonMark reads no escape inside a code span, so a backtick string left beside an escape still closes a span that an earlier bare run of its length opens. function escapeClosedRuns(scan: string, escapings: readonly InlineEscaping[], claimed: ReadonlySet): ReadonlySet { const escaped = new Set(claimed) - // The lengths of the backtick strings an escape forms or splits off: a bare run that long closes the span one opens. + // The lengths of the backtick strings escapes leave: a bare run of one of these lengths would open a span one of them closes, so it is escaped too. const formed = new Set() let end = scan.length - 1 while (end >= 0) { diff --git a/src/markdown/parse/inline-content.ts b/src/markdown/parse/inline-content.ts index 5f4dda0..0d661de 100644 --- a/src/markdown/parse/inline-content.ts +++ b/src/markdown/parse/inline-content.ts @@ -605,7 +605,7 @@ function highlightDelimiters(pieces: readonly Piece[], nodes: readonly Inline[][ return found } -// Each opener takes the next closer holding at least one character after it, both in one stretch and under the same marks. +// Each opener pairs with the next closer at least one character after it, and only when both sit in one stretch under the same marks. function pairedHighlights(pieces: readonly Piece[], nodes: readonly Inline[][]): { closer: number; opener: number }[] { const found = highlightDelimiters(pieces, nodes) const paired: { closer: number; opener: number }[] = []