1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Basic table removal rule

This commit is contained in:
Jake Walker 2023-03-31 19:23:31 +01:00 committed by Frédéric Guillot
parent 9a826bbe6f
commit 49d2596fc6
3 changed files with 43 additions and 0 deletions

View file

@ -335,3 +335,34 @@ func parseMarkdown(entryContent string) string {
return sb.String()
}
func removeTables(entryContent string) string {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(entryContent))
if err != nil {
return entryContent
}
var table *goquery.Selection
for {
table = doc.Find("table").First()
if table.Length() == 0 {
break
}
td := table.Find("td").First()
if td.Length() == 0 {
break
}
tdHtml, _ := td.Html()
table.Parent().AppendHtml(tdHtml)
table.Remove()
}
output, _ := doc.Find("body").First().Html()
return output
}