cleanup and comment
This commit is contained in:
parent
ed8c8ea157
commit
8d5314d66e
1 changed files with 2 additions and 6 deletions
|
|
@ -17,6 +17,7 @@ import (
|
||||||
|
|
||||||
var markdownRenderer goldmark.Markdown
|
var markdownRenderer goldmark.Markdown
|
||||||
|
|
||||||
|
// these are css values from github-markdown.css so we can accurately compute the rendered dimensions
|
||||||
const (
|
const (
|
||||||
MarkdownFontSize = d2fonts.FONT_SIZE_M
|
MarkdownFontSize = d2fonts.FONT_SIZE_M
|
||||||
MarkdownLineHeight = 1.5
|
MarkdownLineHeight = 1.5
|
||||||
|
|
@ -210,12 +211,7 @@ func (ruler *Ruler) measureNode(depth int, n *html.Node, font d2fonts.Font) (wid
|
||||||
spaceWidth := ruler.atlases[font].glyph(spaceRune).advance
|
spaceWidth := ruler.atlases[font].glyph(spaceRune).advance
|
||||||
|
|
||||||
str := n.Data
|
str := n.Data
|
||||||
|
isCode := parentElementType == "pre" || parentElementType == "code"
|
||||||
isCode := false
|
|
||||||
switch parentElementType {
|
|
||||||
case "pre", "code":
|
|
||||||
isCode = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if !isCode {
|
if !isCode {
|
||||||
str = strings.ReplaceAll(str, "\n", " ")
|
str = strings.ReplaceAll(str, "\n", " ")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue