Merge pull request #1872 from GavinNishizawa/update-markdown-coloring

fix style.fill for markdown
This commit is contained in:
Alexander Wang 2024-03-20 10:17:35 -07:00 committed by GitHub
commit 3faa50ccd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 572 additions and 569 deletions

View file

@ -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)

View file

@ -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" {
styles = append(styles, fmt.Sprintf(`background-color:%s`, targetShape.Fill))
}
if !color.IsThemeColor(targetShape.Color) {
styles = append(styles, fmt.Sprintf(`color:%s`, targetShape.Color))
}

View file

@ -1925,7 +1925,7 @@ a line of text and an
walk into a bar.
| {
style.stroke: darkorange
style.font-color: darkorange
}
container -> no container
@ -1935,7 +1935,7 @@ they did it in style
|
no container.style: {
stroke: red
font-color: red
fill: "#CEEDEE"
}
`,

View file

@ -58,7 +58,7 @@
"strokeWidth": 2,
"borderRadius": 0,
"fill": "transparent",
"stroke": "darkorange",
"stroke": "N1",
"shadow": false,
"3d": false,
"multiple": false,
@ -75,7 +75,7 @@
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "markdown",
"color": "N1",
"color": "darkorange",
"italic": false,
"bold": false,
"underline": false,
@ -98,7 +98,7 @@
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#CEEDEE",
"stroke": "red",
"stroke": "N1",
"shadow": false,
"3d": false,
"multiple": false,
@ -115,7 +115,7 @@
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "markdown",
"color": "N1",
"color": "red",
"italic": false,
"bold": false,
"underline": false,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -58,7 +58,7 @@
"strokeWidth": 2,
"borderRadius": 0,
"fill": "transparent",
"stroke": "darkorange",
"stroke": "N1",
"shadow": false,
"3d": false,
"multiple": false,
@ -75,7 +75,7 @@
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "markdown",
"color": "N1",
"color": "darkorange",
"italic": false,
"bold": false,
"underline": false,
@ -98,7 +98,7 @@
"strokeWidth": 2,
"borderRadius": 0,
"fill": "#CEEDEE",
"stroke": "red",
"stroke": "N1",
"shadow": false,
"3d": false,
"multiple": false,
@ -115,7 +115,7 @@
"fontSize": 16,
"fontFamily": "DEFAULT",
"language": "markdown",
"color": "N1",
"color": "red",
"italic": false,
"bold": false,
"underline": false,

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB