Project

General

Profile

Actions

Patch #44621

closed

Hide Mermaid code blocks until the diagrams are rendered

Added by Mizuki ISHIKAWA 27 days ago. Updated 26 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Text formatting
Target version:
-

Description

When a page contains a Mermaid code block, its source is displayed until Mermaid.js is loaded and the diagram is rendered.

The attached patch hides Mermaid code blocks until the diagrams are rendered.

  • Add the mermaid-available class to the html element with JavaScript when Mermaid.js is installed, and hide Mermaid code blocks while the class is present. If JavaScript is disabled, the source stays visible.
  • Use visibility: hidden instead of display: none so that the space of the code block is kept and the content below moves less when the diagram appears.
  • Show the source again if Mermaid.js fails to load or the diagram has a syntax error.

Files


Related issues

Related to Redmine - Feature #44425: Render Mermaid code blocks as diagramsClosedGo MAEDAActions
Actions #1

Updated by Go MAEDA 26 days ago

  • Related to Feature #44425: Render Mermaid code blocks as diagrams added
Actions #2

Updated by Go MAEDA 26 days ago

  • Category set to Text formatting
  • Status changed from New to Closed
  • Assignee set to Go MAEDA

Committed the patch as part of #44425 in r25258. Thank you.

Actions

Also available in: Atom PDF