Skip to content

Commit

Permalink
🎨 改进 HTML 转换 Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jan 9, 2023
1 parent b3175d9 commit 9a4b82c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion h2m.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ func (lute *Lute) genASTByDOM(n *html.Node, tree *parse.Tree) {
src := util.DomAttrValue(n, "src")
if strings.HasPrefix(src, "data:image") {
// 处理可能存在的预加载情况
src = util.DomAttrValue(n, "data-src")
if dataSrc := util.DomAttrValue(n, "data-src"); "" != dataSrc {
src = dataSrc
}
}
node.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: util.StrToBytes(src)})
linkTitle := util.DomAttrValue(n, "title")
Expand Down
2 changes: 1 addition & 1 deletion javascript/lute.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion javascript/lute.min.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lute.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,10 @@ func (lute *Lute) SetIndentCodeBlock(b bool) {
lute.ParseOptions.IndentCodeBlock = b
}

func (lute *Lute) SetDataImage(b bool) {
lute.ParseOptions.DataImage = b
}

func (lute *Lute) SetTextMark(b bool) {
lute.ParseOptions.TextMark = b
}
Expand Down

0 comments on commit 9a4b82c

Please sign in to comment.