Add an export subcommand that writes a Confluence page and its attachments to a directory, mirroring pchuri/confluence-cli's export. This builds on read (page → markdown/storage) by also downloading attachments and laying everything out on disk so the exported markdown's image links resolve locally.
Command
markfluence export ARG [flags]
ARG is a numeric page id or a Confluence page URL (same resolver as read).
Flags (mirroring confluence-cli)
--dest <dir> — output directory (default .).
--file <name> — content filename (default derived from title/id, e.g. <slug>.md).
--attachments-dir <name> — attachments subdirectory (default e.g. attachments/).
--format markdown|storage — content format (default markdown), reusing read's conversion. (confluence-cli also has html/text; markfluence has neither yet — out of scope unless we add them.)
--pattern <glob> — only export attachments matching the glob.
--referenced-only — only download attachments actually referenced in the body.
--skip-attachments — write the content file only.
Filesystem output
<dest>/
<file>.md # page content (markdown by default), with frontmatter
<attachments-dir>/ # downloaded attachment files
...
New capability: downloading attachments
markfluence today lists (ListAttachments) and uploads attachments but never downloads their bytes. Export needs a client method to fetch an attachment's binary (v1 .../download or the attachment _links.download), plus listing/pagination.
The image-link reconciliation (the crux)
read's markdown emits the flattened attachment filename (assets/x.png → assets_x.png) as the image src. For an export to be self-contained, the downloaded files and the markdown srcs must line up — e.g. download each attachment into <attachments-dir>/ and rewrite image srcs to <attachments-dir>/<filename>. This also closes the local-image round-trip gap noted during the read work (reading a page couldn't recover image bytes/paths).
Open questions
- Default content filename: slugified title, page id, or require
--file?
- Attachment name collisions (Confluence allows multiple attachments; flattened names could clash) — how to disambiguate.
--referenced-only scope: only ac:image/ri:attachment references, or also links to attachments?
- Should
export also emit enough for a later create/update (frontmatter with page_id), so an exported tree round-trips back? (It would, via the markdown frontmatter.)
- Multi-page export (a page + its descendants) — out of scope for v1, or a
--recursive/depth flag later?
References
Add an
exportsubcommand that writes a Confluence page and its attachments to a directory, mirroring pchuri/confluence-cli'sexport. This builds onread(page → markdown/storage) by also downloading attachments and laying everything out on disk so the exported markdown's image links resolve locally.Command
ARGis a numeric page id or a Confluence page URL (same resolver asread).Flags (mirroring confluence-cli)
--dest <dir>— output directory (default.).--file <name>— content filename (default derived from title/id, e.g.<slug>.md).--attachments-dir <name>— attachments subdirectory (default e.g.attachments/).--format markdown|storage— content format (default markdown), reusingread's conversion. (confluence-cli also hashtml/text; markfluence has neither yet — out of scope unless we add them.)--pattern <glob>— only export attachments matching the glob.--referenced-only— only download attachments actually referenced in the body.--skip-attachments— write the content file only.Filesystem output
New capability: downloading attachments
markfluence today lists (
ListAttachments) and uploads attachments but never downloads their bytes. Export needs a client method to fetch an attachment's binary (v1.../downloador the attachment_links.download), plus listing/pagination.The image-link reconciliation (the crux)
read's markdown emits the flattened attachment filename (assets/x.png→assets_x.png) as the imagesrc. For an export to be self-contained, the downloaded files and the markdownsrcs must line up — e.g. download each attachment into<attachments-dir>/and rewrite imagesrcs to<attachments-dir>/<filename>. This also closes the local-image round-trip gap noted during thereadwork (reading a page couldn't recover image bytes/paths).Open questions
--file?--referenced-onlyscope: onlyac:image/ri:attachmentreferences, or also links to attachments?exportalso emit enough for a latercreate/update(frontmatter withpage_id), so an exported tree round-trips back? (It would, via the markdown frontmatter.)--recursive/depth flag later?References
readsubcommand and the storage→markdown converter (merged).