This commit is contained in:
Daniel 2024-06-02 23:40:31 +08:00
parent 3a707fd884
commit 05585240f9
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 12 additions and 5 deletions

View file

@ -63,6 +63,13 @@ func HTML2Markdown(htmlStr string) (markdown string, withMath bool, err error) {
return ast.WalkContinue
}
if ast.NodeText == n.Type {
if n.ParentIs(ast.NodeTableCell) {
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("\\|"), []byte("|"))
n.Tokens = bytes.ReplaceAll(n.Tokens, []byte("|"), []byte("\\|"))
}
}
if ast.NodeInlineMath == n.Type {
withMath = true
return ast.WalkContinue