Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix style.fill for markdown #1872

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
- Fixes styles in connections not overriding styles set by globs [#1857](https://github.com/terrastruct/d2/pull/1857)
- Fixes `null` being set on a nested shape not working in certain cases when connections also pointed to that shape [#1830](https://github.com/terrastruct/d2/pull/1830)
- Fixes edge case of bad import syntax crashing using d2 as a library [#1829](https://github.com/terrastruct/d2/pull/1829)
- Fixes `style.fill` not applying to markdown [#1872](https://github.com/terrastruct/d2/pull/1872)
alixander marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion d2renderers/d2svg/d2svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,9 @@ func drawShape(writer, appendixWriter io.Writer, diagramHash string, targetShape
if targetShape.FontSize != textmeasure.MarkdownFontSize {
styles = append(styles, fmt.Sprintf("font-size:%vpx", targetShape.FontSize))
}

if targetShape.Fill != "" && targetShape.Fill != "transparent" {
alixander marked this conversation as resolved.
Show resolved Hide resolved
styles = append(styles, fmt.Sprintf(`background-color:%s`, targetShape.Fill))
}
if !color.IsThemeColor(targetShape.Color) {
styles = append(styles, fmt.Sprintf(`color:%s`, targetShape.Color))
}
Expand Down
4 changes: 2 additions & 2 deletions e2etests/stable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ a line of text and an

walk into a bar.
| {
style.stroke: darkorange
style.font-color: darkorange
}

container -> no container
Expand All @@ -1935,7 +1935,7 @@ they did it in style
|

no container.style: {
stroke: red
font-color: red
fill: "#CEEDEE"
}
`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

566 changes: 283 additions & 283 deletions e2etests/testdata/stable/markdown_stroke_fill/dagre/sketch.exp.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

566 changes: 283 additions & 283 deletions e2etests/testdata/stable/markdown_stroke_fill/elk/sketch.exp.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.