|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#### Improvements 🧹
|
#### Improvements 🧹
|
||||||
|
|
||||||
|
- Code snippets use bold and italic font styles as determined by highlighter [#710](https://github.com/terrastruct/d2/issues/710), [#741](https://github.com/terrastruct/d2/issues/741)
|
||||||
|
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
||||||
- Fixes groups overlapping in sequence diagrams when they end in a self loop. [#728](https://github.com/terrastruct/d2/pull/728)
|
- Fixes groups overlapping in sequence diagrams when they end in a self loop. [#728](https://github.com/terrastruct/d2/pull/728)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ func styleAttr(styles map[chroma.TokenType]string, tt chroma.TokenType) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return styles[tt]
|
out := strings.Replace(styles[tt], `font-weight="bold"`, `class="text-mono-bold"`, -1)
|
||||||
|
return strings.Replace(out, `font-style="italic"`, `class="text-mono-italic"`, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// <<< END
|
// <<< END
|
||||||
|
|
|
||||||
|
|
@ -1181,6 +1181,44 @@ func embedFonts(buf *bytes.Buffer, fontFamily *d2fonts.FontFamily) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
triggers = []string{
|
||||||
|
`class="text-mono-bold"`,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, t := range triggers {
|
||||||
|
if strings.Contains(content, t) {
|
||||||
|
fmt.Fprintf(buf, `
|
||||||
|
.text-mono-bold {
|
||||||
|
font-family: "font-mono-bold";
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: font-mono-bold;
|
||||||
|
src: url("%s");
|
||||||
|
}`,
|
||||||
|
d2fonts.FontEncodings[d2fonts.SourceCodePro.Font(0, d2fonts.FONT_STYLE_BOLD)])
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers = []string{
|
||||||
|
`class="text-mono-italic"`,
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, t := range triggers {
|
||||||
|
if strings.Contains(content, t) {
|
||||||
|
fmt.Fprintf(buf, `
|
||||||
|
.text-mono-italic {
|
||||||
|
font-family: "font-mono-italic";
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: font-mono-italic;
|
||||||
|
src: url("%s");
|
||||||
|
}`,
|
||||||
|
d2fonts.FontEncodings[d2fonts.SourceCodePro.Font(0, d2fonts.FONT_STYLE_ITALIC)])
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buf.WriteString(`]]></style>`)
|
buf.WriteString(`]]></style>`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 512 KiB After Width: | Height: | Size: 601 KiB |
|
Before Width: | Height: | Size: 512 KiB After Width: | Height: | Size: 601 KiB |
|
Before Width: | Height: | Size: 508 KiB After Width: | Height: | Size: 673 KiB |
|
Before Width: | Height: | Size: 508 KiB After Width: | Height: | Size: 673 KiB |
|
Before Width: | Height: | Size: 669 KiB After Width: | Height: | Size: 758 KiB |
|
Before Width: | Height: | Size: 669 KiB After Width: | Height: | Size: 758 KiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 602 KiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 602 KiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 602 KiB |
|
Before Width: | Height: | Size: 513 KiB After Width: | Height: | Size: 602 KiB |
|
Before Width: | Height: | Size: 843 KiB After Width: | Height: | Size: 932 KiB |
|
Before Width: | Height: | Size: 842 KiB After Width: | Height: | Size: 931 KiB |