Skip to content

Draft: prototype Mermaid embeds for Markdown preview#30716

Draft
dankarization wants to merge 1 commit into
telegramdesktop:devfrom
dankarization:prototype/markdown-mermaid-embed
Draft

Draft: prototype Mermaid embeds for Markdown preview#30716
dankarization wants to merge 1 commit into
telegramdesktop:devfrom
dankarization:prototype/markdown-mermaid-embed

Conversation

@dankarization
Copy link
Copy Markdown

Summary

Prototype support for fenced mermaid blocks in Markdown preview.

This patch converts code fences with language mermaid into a clickable placeholder that opens an embedded preview overlay and attempts to render the diagram there.

Related issue: #30715

What this does

  • detects fenced code blocks with info string mermaid
  • prepares them as a markdown placeholder instead of a plain code block
  • attaches an embedded HTML resource to the placeholder
  • renders the diagram inside the existing markdown embed overlay
  • reports preferred size back to the overlay so the preview can resize

Why draft

This is a prototype path, not a polished final implementation.

Known limitations:

  • it loads Mermaid from an external CDN instead of a bundled local runtime
  • it has not gone through the full Telegram Desktop build/test pipeline
  • it does not yet include screenshot/golden tests for rendered output
  • fallback behavior is intentionally minimal

Intent

The point of this PR is to show a concrete integration path using the existing markdown placeholder + embed overlay infrastructure, so the discussion can move from abstract feature request to a real patch shape.

If this direction makes sense, the next obvious steps would be:

  • replace CDN loading with a vendored/runtime-approved Mermaid integration
  • add proper rendering tests
  • refine placeholder text and failure UX

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants