feat(outline): convert to post — S4 (#114)
CI / ci (push) Canceled after 0s

In-place outline→post conversion on the piece: id, folder, Pass
State, origin kept, type frontmatter flips to post, body transforms
once. The ask picks the transform — Verbatim Bullets (default,
lossless) or Headings ladder (roots ##, stepping to the ###### floor,
deeper stays bullets), with a warning when the ladder would drop
paragraph lines between bullets.

The open session flushes first, then reopens routed to prose via
proseOverridePostID (lastDraftWasOutline's machinery reversed).
An outline that went lossy on disk behind an unwarned ask aborts
the convert; an unanswered #67 conflict aborts every flush-first
op (shared flushOrAbort seam); rescan no longer hands a same-id
reopened session its predecessor's stale disk text; a held #111
guard ask dies with the outline it pointed at.

Audit round (finish-audit, three reviewers) included: 13 new pins,
206 tests green, pin discrimination verified. Record:
docs/devlog/20261016-issue114-convert-to-post_log.md
This commit is contained in:
AlexKucera committed 2026-10-16 18:03:41 +02:00
1 parent 21e2f27450
commit c0513aae85
14 files changed
+547 -19

No files matched your search

+16
View File
@@ -307,4 +307,20 @@ struct OutlineTreeTests {
#expect(!OutlineTree.insertRun([], parentPath: [], index: 0, in: &nodes))
#expect(nodes.map(\.text) == ["r1", "r2", "a", "x", "b"])
}
@Test func `headingsLadderBody maps levels to headings with a bullet floor`() {
let body = "# Title\n- a\n - a1\n - a2\n - a3\n - a4\n - a4x\n - deep"
// roots ##, one heading per level to the ###### floor, deeper
// levels stay bullets re-based flush under it; preamble verbatim.
#expect(
OutlineTree.headingsLadderBody(body)
== "# Title\n## a\n### a1\n#### a2\n##### a3\n###### a4\n- a4x\n - deep",
)
// mixed content: prose between bullets drops (the ask warns)
#expect(OutlineTree.headingsLadderBody("- a\nprose\n- b") == "## a\n## b")
// identity edges: empty in → empty out; prose-only body is all
// preamble → rides verbatim (nothing to ladder)
#expect(OutlineTree.headingsLadderBody("") == "")
#expect(OutlineTree.headingsLadderBody("# Just a title\nsome words") == "# Just a title\nsome words")
}
}