From f594dafc5b641d1b413b91096d1c78a91f08437a Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 26 Sep 2026 13:26:20 +0200 Subject: [PATCH] 10c - review: link and code span edges named in the README, 10e filed, leafEdges trail simplified --- README.md | 2 +- src/markdown/emit/plain-inline.ts | 4 ++-- src/markdown/emit/plain-reduction.ts | 2 +- todo.md | 8 ++++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a00569..a690a6f 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ does not come back. `_(link card not included)_`, `_(extension not included)_`. - `code`, `em`, `link`, `strike` and `strong` stay; every other mark drops, keeping its text, and so does a mark CommonMark cannot spell where it stands. -- A newline in text is a hard break, edge whitespace is trimmed, carriage returns and null +- A newline in text is a hard break, edge whitespace outside a link or code span is trimmed, carriage returns and null characters are removed, and an empty paragraph drops. - An ordered list numbered past `999999999`, or adjacent ordered lists whose numbering does not continue, is one bullet list keeping its numbers as text. diff --git a/src/markdown/emit/plain-inline.ts b/src/markdown/emit/plain-inline.ts index 47fcb2d..4fec787 100644 --- a/src/markdown/emit/plain-inline.ts +++ b/src/markdown/emit/plain-inline.ts @@ -221,9 +221,9 @@ function leafEdges(leaf: AdfNode, previous: AdfNode | undefined, next: AdfNode | const text = leaf.text if (text === undefined || marks.some((mark) => mark.type === 'code')) return undefined const lead = text.slice(0, text.search(/[^ \t]|$/)) - const trail = text.slice(Math.max(lead.length, text.search(/[ \t]*$/))) + const trail = text.slice(text.search(/[ \t]*$/)) const leadDepth = edgeDepth(marks, previous, lead) - const trailDepth = edgeDepth(marks, next, lead === text ? text : trail) + const trailDepth = edgeDepth(marks, next, trail) if (leadDepth === marks.length && trailDepth === marks.length) return undefined if (lead === text) return leadDepth === undefined || trailDepth === undefined ? [] : [textLeaf(text, marks.slice(0, Math.min(leadDepth, trailDepth)))] const edges: AdfNode[] = [] diff --git a/src/markdown/emit/plain-reduction.ts b/src/markdown/emit/plain-reduction.ts index fd7ccca..efd6595 100644 --- a/src/markdown/emit/plain-reduction.ts +++ b/src/markdown/emit/plain-reduction.ts @@ -1,8 +1,8 @@ import type { AdfDocument, AdfNode } from '../../adf/document.ts' import { adfDocumentFault, nodeAttrs, nodeContent } from '../../adf/document.ts' +import { adfToMarkdown, commonMarkSpelling, largestListMarker, type SpellingMemo } from './adf-to-markdown.ts' import { alertMarker, foldedAlertMarker, taskMarker } from '../plain-conventions.ts' import { blockNodeModel } from '../../adf/block-nodes.ts' -import { adfToMarkdown, commonMarkSpelling, largestListMarker, type SpellingMemo } from './adf-to-markdown.ts' import { failure, faulted, success, type ConvertErrorPath, type Result } from '../../result.ts' import { inlineLeaves, isBlockNodeType, oneLine, reduceInline, writableHref } from './plain-inline.ts' import { inlineNodeModel } from '../../adf/inline-nodes.ts' diff --git a/todo.md b/todo.md index fb7016b..1174f33 100644 --- a/todo.md +++ b/todo.md @@ -266,6 +266,14 @@ chunk clearing a §11 seam. it is a gap to ask. The same class runs the other way: a highlighted `=` writes `=====`, which reads back as text, and a highlighted `a==b` writes `==a==b==`, highlighting `a` alone; 10c's byte-for-byte property misses both, since the wrong document re-spells to the same bytes. + - [ ] **10e — A callout's body stays its body.** `plainMarkdownToAdf` reads Obsidian's own + spelling, `> [!faq]- Why?` with the body on the next `>` line, as an expand titled with the + whole paragraph — `"Why? See the docs and code."` — and an empty body, dropping the link + target and the code mark Goal 5 keeps; an unfolded `> [!tip] Title` merges the title into + the body's first line. Item 10's settled "the rest of the marker's paragraph as its title" + reads against Goal 5 here, and the line edge is gone once `markdownToAdf` has joined the + paragraph, so which seam reads it is part of the gap to ask: candidate rule "the title is + the marker's line; the lines after it open the body" (10c's review, 2026-09-26). - [x] **11 — Atlassian's ADF schema as the tables' truth.** - [x] **11a — The vendored schema.** - [x] **11b — The gate.**