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

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,7 @@ require (
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
github.com/88250/gulu v1.2.3-0.20240505150113-bc43bd50f866
github.com/88250/lute v1.7.7-0.20240602133724-442f4d587df8
github.com/88250/lute v1.7.7-0.20240602153357-e36a63bb1689
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

View file

@ -12,8 +12,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20240505150113-bc43bd50f866 h1:RFfNFS0hv6TbOuwET6xZAfGlV4hNlXiWTnfbLN1eF6k=
github.com/88250/gulu v1.2.3-0.20240505150113-bc43bd50f866/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
github.com/88250/lute v1.7.7-0.20240602133724-442f4d587df8 h1:GSelPDKdst2s8Gbh2/hu/2zFIzQ2XmuJNQS8rz+qnV0=
github.com/88250/lute v1.7.7-0.20240602133724-442f4d587df8/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
github.com/88250/lute v1.7.7-0.20240602153357-e36a63bb1689 h1:z7h8QF23XO8s8aYIiMvVqyJgLdGxxo/P+g6LKI8bt2w=
github.com/88250/lute v1.7.7-0.20240602153357-e36a63bb1689/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

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