rnotes-online/backlog/tasks/task-8 - Markdown-export-im...

1.5 KiB

id title status assignee created_date updated_date labels dependencies priority
TASK-8 Markdown export/import Done
2026-02-13 20:39 2026-02-25 05:19
low

Description

Export notes as .md files, import .md files as notes. Batch export notebooks as zip of markdown files.

Final Summary

Implemented plain Markdown export/import for rNotes.

Export (GET /api/export/markdown)

  • Single note: ?noteId=<id> returns a .md file with YAML frontmatter (type, tags, url, notebook, dates) and markdown body
  • Batch: Returns a ZIP archive of all user notes as notes/*.md + attachments/*
  • Notebook filter: ?notebookId=<id> exports only that notebook's notes
  • Uses stored bodyMarkdown or converts from TipTap JSON via tipTapJsonToMarkdown()

Import (POST /api/import/markdown)

  • Accepts multiple .md files and/or .zip archives via multipart form
  • Parses YAML frontmatter for metadata (type, tags, url, language, pinned)
  • Extracts title from first # heading or filename
  • Dual-write: converts markdown → TipTap JSON → HTML for full format coverage
  • Creates tags automatically via upsert
  • ZIP imports also handle attachments/ and assets/ directories
  • Optional notebookId form field to assign imported notes to a notebook

Files

  • src/app/api/export/markdown/route.ts (new)
  • src/app/api/import/markdown/route.ts (new)