Skip to content

MI-T4: Markdown import (.md → new page, hydrate-on-open) #59

Description

@coderhd

Parent

#26 — H0 — Markdown Import/Export (full round-trip)

What to build

A .md file becomes a new page: frontmatter → title + pages.properties + tags; body → rich editor content written through the existing collaboration path (hydrate-on-open — no new server route). Imported [[wikilinks]]/#tags are indexed by the graph index service like normal edits, and the server-side graph index folds properties.tags into the tag index so imported frontmatter tags are searchable.

Acceptance criteria

  • A dashboard Import action accepts a .md file; import creates a page and navigates the user to it.
  • services/import.ts parses the file: title from frontmatter (fallback: filename), frontmatter keys → pages.properties, tagsproperties.tags; parses the body via the round-trip engine; creates the page; stashes the body in a per-tab payload store keyed by page id.
  • EditorWorkspace accepts initialContent and hydrates the editor on first mount only when the doc is empty; the payload is cleared after consumption; a refresh before hydration just opens the page empty.
  • server/graph-index.js indexPage reads pages.properties and folds properties.tags (array or comma/space-separated string) into the tag rows written via sync_page_graph; body tags and wikilinks still extracted; links resolution unchanged. sync_page_graph remains service-key-only.
  • Success toast on import; clear error (no page created) for empty/malformed files; frontmatter-less files import cleanly.
  • Viewer/read-only surfaces show no import action.
  • Focused unit tests pass (import service, hydration helper, graph-index tag fold); npm run lint and npm run build green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions