Skip to content

[Feature]: Markdown import should keep video, audio, and embed nodes #152

Description

@HMarzban

Problem statement

Settings → Import & export → Replace with a file turns Markdown into Tiptap JSON, then applies it with setContent.

A provider URL or a file path in that Markdown becomes a link. It does not become a video, audio, youtube, vimeo, loom, soundcloud, spotify, or x node.

The live local /demo page holds those nodes. PROPOSAL-demo/DEMO.md names the same files and URLs, so a Markdown replace drops the players even when the words match.

Sister ticket: #151 (picture width and height). Same import path, different gap.

Proposed solution

A Markdown replace that includes these lines should leave playable media in the document, not only links:

  • /demo-assets/demo-video.mp4 and /demo-assets/demo-audio.mp3 as uploaded video / audio nodes
  • The six provider URLs already in DEMO.md as the matching embed nodes (YouTube, Vimeo, Loom, SoundCloud, Spotify, X)

How we recognise a URL as a player is an implementation choice. The existing paste-to-embed rules in the editor are the behaviour to match. Do not invent a second URL classifier.

Alternatives considered

  • Leave DEMO.md as links and write Tiptap JSON through PATCH /content when the page must show players. Works today. Does not help Settings → Replace.
  • Ask the reader to paste each URL after import. Works. Does not scale.

Impact

Anyone who replaces a document from .md and expects a pasted media URL to play in place. The demo page is the first document that needs this.

Acceptance criteria

  • Importing PROPOSAL-demo/DEMO.md through Settings → Replace leaves a playable video and a playable audio where those files are named.
  • The six provider URLs in that file become embed nodes of the right type, not hyperlinks.
  • A URL that is not a known provider or media file stays a link.
  • Picture alt and the italic line under a picture still survive (do not regress [Feature]: Markdown import should keep image width and height #151).
  • A successful replace still does not throw.

Blocked by

None — can start immediately. Related to #151; they can land in either order.

Additional context

  • Repro file: PROPOSAL-demo/DEMO.md (Video and audio, Embeds).
  • Apply path: Settings replace → conversion JSON → setContent.
  • Markdown import shares the export manager and does not run the editor paste rules.

Checklist

  • I searched existing issues and discussions first.
  • This request is scoped to a concrete problem.
  • I included enough context for maintainers to evaluate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions