#123

Not supported in labels: `<s>`, `<del>` and `<strike>`

Openmetonymopened 28d ago

Description

Pele drops <s>, <del> and <strike> in labels and draws their text plain. It already draws <u> and <ins> as underlined. Docs often use strikethrough to show what was removed or replaced, so the meaning is lost.

Steps to reproduce

Render this diagram with render():

flowchart LR
  A["<s>old</s> new"] --> B["<u>under</u> and <del>gone</del>"]

Expected

"old" and "gone" have a line through them. Mermaid 12.3.0 draws labels as HTML, and the browser draws all three tags with text-decoration-line: line-through.

Actual

Node A is plain text. Node B keeps its underline but loses the strikethrough:

<!-- node A -->
<text class="pele-label" x="0" y="5.6" text-anchor="middle">
  old new
</text>
<!-- node B -->
<text class="pele-label" text-anchor="middle" xml:space="preserve">
  <tspan x="0" y="5.6" text-decoration="underline">under</tspan>
  <tspan> and gone</tspan>
</text>
Mermaid 12.3.0Pele 1.13.0

Environment

  • pele 1.13.0 (npm)
  • Mermaid 12.3.0 for comparison

Possible fix

The underline path has all the pieces:

  • TAG_STYLES in src/text/label.ts maps u and ins to Style.Underline. s, del and strike could map to a new Style.Strike.
  • spanStyle() in src/svg/builder.ts writes text-decoration="underline". It could write line-through, or underline line-through for a span with both.
  • textBlock() in src/diagrams/kanban/render.ts has a single-span fast path that skips Style.Underline. It needs to skip Style.Strike too, or kanban cards lose the line.

Widths don't change, because a line through the text takes no room. I have a patch and can open a PR.

Activity

0

No activity yet.