cleanup
This commit is contained in:
parent
fb6076dd59
commit
f2603b39ef
2 changed files with 7 additions and 5 deletions
|
|
@ -12,5 +12,4 @@
|
||||||
- System dark mode was incorrectly applying to markdown in renders.
|
- System dark mode was incorrectly applying to markdown in renders.
|
||||||
[#159](https://github.com/terrastruct/d2/issues/159)
|
[#159](https://github.com/terrastruct/d2/issues/159)
|
||||||
- Fixes markdown newlines created with a trailing double space or backslash.
|
- Fixes markdown newlines created with a trailing double space or backslash.
|
||||||
[#212](https://github.com/terrastruct/d2/issues/212)
|
[#214](https://github.com/terrastruct/d2/pull/214)
|
||||||
[#209](https://github.com/terrastruct/d2/issues/209)
|
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ func (b *blockAttrs) isNotEmpty() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// measures node dimensions to match rendering with styles in github-markdown.css
|
// measures node dimensions to match rendering with styles in github-markdown.css
|
||||||
func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (block blockAttrs) {
|
func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) blockAttrs {
|
||||||
var parentElementType string
|
var parentElementType string
|
||||||
if n.Parent != nil && n.Parent.Type == html.ElementNode {
|
if n.Parent != nil && n.Parent.Type == html.ElementNode {
|
||||||
parentElementType = n.Parent.Data
|
parentElementType = n.Parent.Data
|
||||||
|
|
@ -210,7 +210,7 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (blo
|
||||||
switch n.Type {
|
switch n.Type {
|
||||||
case html.TextNode:
|
case html.TextNode:
|
||||||
if strings.TrimSpace(n.Data) == "" {
|
if strings.TrimSpace(n.Data) == "" {
|
||||||
return
|
return blockAttrs{}
|
||||||
}
|
}
|
||||||
spaceWidths := 0.
|
spaceWidths := 0.
|
||||||
|
|
||||||
|
|
@ -272,6 +272,8 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (blo
|
||||||
isCode = true
|
isCode = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
block := blockAttrs{}
|
||||||
|
|
||||||
if n.FirstChild != nil {
|
if n.FirstChild != nil {
|
||||||
first := getNext(n.FirstChild)
|
first := getNext(n.FirstChild)
|
||||||
last := getPrev(n.LastChild)
|
last := getPrev(n.LastChild)
|
||||||
|
|
@ -398,6 +400,7 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (blo
|
||||||
if block.height > 0 && block.height < MarkdownLineHeightPx {
|
if block.height > 0 && block.height < MarkdownLineHeightPx {
|
||||||
block.height = MarkdownLineHeightPx
|
block.height = MarkdownLineHeightPx
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return block
|
return block
|
||||||
|
}
|
||||||
|
return blockAttrs{}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue