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.
|
||||
[#159](https://github.com/terrastruct/d2/issues/159)
|
||||
- Fixes markdown newlines created with a trailing double space or backslash.
|
||||
[#212](https://github.com/terrastruct/d2/issues/212)
|
||||
[#209](https://github.com/terrastruct/d2/issues/209)
|
||||
[#214](https://github.com/terrastruct/d2/pull/214)
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ func (b *blockAttrs) isNotEmpty() bool {
|
|||
}
|
||||
|
||||
// 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
|
||||
if n.Parent != nil && n.Parent.Type == html.ElementNode {
|
||||
parentElementType = n.Parent.Data
|
||||
|
|
@ -210,7 +210,7 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (blo
|
|||
switch n.Type {
|
||||
case html.TextNode:
|
||||
if strings.TrimSpace(n.Data) == "" {
|
||||
return
|
||||
return blockAttrs{}
|
||||
}
|
||||
spaceWidths := 0.
|
||||
|
||||
|
|
@ -272,6 +272,8 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (blo
|
|||
isCode = true
|
||||
}
|
||||
|
||||
block := blockAttrs{}
|
||||
|
||||
if n.FirstChild != nil {
|
||||
first := getNext(n.FirstChild)
|
||||
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 {
|
||||
block.height = MarkdownLineHeightPx
|
||||
}
|
||||
return block
|
||||
}
|
||||
return block
|
||||
return blockAttrs{}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue