Skip to content

d2svg: render underline style on markdown labels - #2858

Closed
SR0725 wants to merge 1 commit into
d2lang:masterfrom
SR0725:fix/markdown-underline
Closed

d2svg: render underline style on markdown labels#2858
SR0725 wants to merge 1 commit into
d2lang:masterfrom
SR0725:fix/markdown-underline

Conversation

@SR0725

@SR0725 SR0725 commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Markdown labels kept style.underline in the target shape, but the SVG renderer did not apply it inside the foreignObject. This adds text-decoration: underline to the Markdown container only when that style is enabled.

The new Dagre e2e fixture covers the rendered HTML and board data for an underlined Markdown label.

Validation

  • ./make.sh fmt
  • ./make.sh lint
  • ./make.sh test
  • ./make.sh race
  • ./make.sh build

Result

Underlined Markdown label

The change only affects Markdown shapes with style.underline: true; other Markdown and plain-text labels keep their existing rendering.

Implementation and validation were assisted by OpenAI Codex; I reviewed the diff and test output.

Fixes #1959

@SR0725

SR0725 commented Aug 30, 2026

Copy link
Copy Markdown
Author

Current master now covers the underline case through #2866. The native Markdown renderer passes targetShape.Underline into markdown.render, and d2renderers/d2svg/markdown_native_test.go asserts the resulting text-decoration="underline". That supersedes this foreignObject patch, so I’m closing it instead of rebasing a redundant implementation.

@SR0725 SR0725 closed this Aug 30, 2026
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.

underlined markdown doesn't work

1 participant