Enable HTML labels in Mermaid diagram rendering #152

Open
opened 2026-01-23 10:18:53 +00:00 by mprihoda · 3 comments
mprihoda commented 2026-01-23 10:18:53 +00:00 (Migrated from github.com)

Problem

Mermaid diagrams rendered in the dashboard don't support HTML/Markdown in labels, causing formatting issues. For example, when a diagram uses line breaks and italics in node labels like:

flowchart LR
  A["DocumentMatrixTableEnhanced<br/><i>modified</i>"]

The <br/> and <i> tags are rendered literally instead of being interpreted as HTML, resulting in labels like DocumentMatrixTableEnhancedmodified instead of:

DocumentMatrixTableEnhanced
modified (in italics)

GitLab renders these correctly because it runs Mermaid in "Markdown-compatible" mode with HTML labels enabled.

Solution

Update the Mermaid configuration to enable HTML labels:

mermaid.initialize({
  flowchart: {
    htmlLabels: true,
    useMaxWidth: false
  }
  // ... other config
});

This will allow:

  • <br/> for line breaks in labels
  • <i>, <b>, etc. for text formatting
  • Markdown syntax like _italic_ in labels (depending on Mermaid version)

Security Consideration

Enabling htmlLabels: true allows HTML in diagram labels. Since we control the content being rendered (review artifacts, analysis documents), this should be safe. However, if user-provided content is ever rendered, sanitization would be needed.

References

## Problem Mermaid diagrams rendered in the dashboard don't support HTML/Markdown in labels, causing formatting issues. For example, when a diagram uses line breaks and italics in node labels like: ```mermaid flowchart LR A["DocumentMatrixTableEnhanced<br/><i>modified</i>"] ``` The `<br/>` and `<i>` tags are rendered literally instead of being interpreted as HTML, resulting in labels like `DocumentMatrixTableEnhancedmodified` instead of: ``` DocumentMatrixTableEnhanced modified (in italics) ``` GitLab renders these correctly because it runs Mermaid in "Markdown-compatible" mode with HTML labels enabled. ## Solution Update the Mermaid configuration to enable HTML labels: ```javascript mermaid.initialize({ flowchart: { htmlLabels: true, useMaxWidth: false } // ... other config }); ``` This will allow: - `<br/>` for line breaks in labels - `<i>`, `<b>`, etc. for text formatting - Markdown syntax like `_italic_` in labels (depending on Mermaid version) ## Security Consideration Enabling `htmlLabels: true` allows HTML in diagram labels. Since we control the content being rendered (review artifacts, analysis documents), this should be safe. However, if user-provided content is ever rendered, sanitization would be needed. ## References - [GitLab Mermaid documentation](https://docs.gitlab.com/ee/user/markdown.html#mermaid) - [Mermaid flowchart configuration](https://mermaid.js.org/config/schema-docs/config-defs-flowchart-diagram-config.html)
Member

Intake: agent-ready
Workflow: diagnostic
Reason: all gates passed
Analysis: project-management/issues/IW-152/analysis.md on branch IW-152

Intake: agent-ready Workflow: diagnostic Reason: all gates passed Analysis: project-management/issues/IW-152/analysis.md on branch IW-152
Member

Implement: needs-human
Reason: batch-implement exit 1 — the kanon plugin command did not compile against the iw-cli core of this branch, so no phase ran

ForgeCatchUp.scala in the kanon plugin expects fetchPullRequestForBranch to return Either[String, …]. iw-cli main returns Either[TrackerError, …] since #778. The cause is in the plugin, not in this issue: the branch is current with main, and no batch-implement.log was written. Every iw-cli issue fails the same way until the plugin is updated. When the plugin compiles, release this issue to agent-ready again.

[error] /home/mph/.local/share/iw/plugins/kanon/lib/batch/ForgeCatchUp.scala:143:7
[error] Found:    Either[iw.core.model.TrackerError, Option[batch.ForgeState]]
[error] Required: Either[String, Option[batch.ForgeState]]
Compilation failed
Implement: needs-human Reason: batch-implement exit 1 — the kanon plugin command did not compile against the iw-cli core of this branch, so no phase ran `ForgeCatchUp.scala` in the kanon plugin expects `fetchPullRequestForBranch` to return `Either[String, …]`. iw-cli `main` returns `Either[TrackerError, …]` since #778. The cause is in the plugin, not in this issue: the branch is current with `main`, and no `batch-implement.log` was written. Every iw-cli issue fails the same way until the plugin is updated. When the plugin compiles, release this issue to `agent-ready` again. ``` [error] /home/mph/.local/share/iw/plugins/kanon/lib/batch/ForgeCatchUp.scala:143:7 [error] Found: Either[iw.core.model.TrackerError, Option[batch.ForgeState]] [error] Required: Either[String, Option[batch.ForgeState]] Compilation failed ```
Member

Release: the implement loop failed this issue for a reason outside it. The kanon plugin did not compile against iw-cli main, because the tracker port now returns TrackerError (iw-cli #778). The plugin fix is dev-docs #484, and iw-cli 0.22.1 carries the core change. The issue goes back to the implement loop.

Release: the implement loop failed this issue for a reason outside it. The kanon plugin did not compile against iw-cli main, because the tracker port now returns TrackerError (iw-cli #778). The plugin fix is dev-docs #484, and iw-cli 0.22.1 carries the core change. The issue goes back to the implement loop.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/iw-cli#152
No description provided.