docs/plans/2026-10-05-export.md
23 lines · 1963 bytes
1# Export Implementation Plan
2
3> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
5**Goal:** Native HTML and Markdown export from OrgCore's tree, and every other format through Emacs.
6
7**Architecture:** `OrgCore/Export/HTMLExport.swift` renders the tree in the shape orgo gives, since the org-conformance corpus (orgo's output, checked against `ox-html`) is the reference the design names: `*` is `<h2>` with a `CUSTOM_ID` or slug id, TODO/priority/tag spans, `<strong>`/`<em>`/`<code>`, timestamps as `<time>` with ranges joined by `–`, footnotes numbered by first reference and listed in a closing `<section>`, captioned or `ATTR_HTML` images as `<figure>`, lists split where bullets change between ordered and unordered, quote/center/special block contents rendered as org, export blocks for html only. `page` wraps the body with the title, author and date and a small stylesheet. `MarkdownExport.swift` writes GitHub-flavored Markdown. Both follow `:exports` for src blocks and their results and run nothing. The app writes `file.html`/`file.md` beside the file as Emacs's dispatcher does (`C-c C-e h h`, `h o`, `m m`, File ▸ Export); PDF, LaTeX, ODT and plain text run `emacs --batch` on the buffer's text with `org-export-use-babel` off.
8
9**Tech Stack:** Swift 6.2 tools, Swift Testing.
10
11**Spec:** `docs/design.md`, "Phase 5", "Testing" (conformance).
12
13## Global Constraints
14
15- The 12 in-scope org-conformance cases (vendored in `Tests/OrgCoreTests/Conformance`) match their skeletons.
16- Markdown is GitHub-flavored, not `ox-md` (which leaves tables as HTML and code as indented blocks).
17
18---
19
20- [x] HTML body, page, skeleton reduction, conformance; `:exports`.
21- [x] Markdown.
22- [x] App: export commands, menu, keys; `EmacsRunner.export`; corpus smoke test.
23- [x] Commit "Export".