Override commonmark escape rule

This commit is contained in:
Vilsol 2021-12-04 07:47:48 +02:00
parent 94b9b16844
commit b27e6fc9f1

View file

@ -5,6 +5,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/PuerkitoBio/goquery"
md "github.com/JohannesKaufmann/html-to-markdown" md "github.com/JohannesKaufmann/html-to-markdown"
"github.com/charmbracelet/bubbles/help" "github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
@ -173,6 +175,13 @@ func (m modInfo) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
} }
converter := md.NewConverter("", true, nil) converter := md.NewConverter("", true, nil)
converter.AddRules(md.Rule{
Filter: []string{"#text"},
Replacement: func(content string, selec *goquery.Selection, options *md.Options) *string {
text := selec.Text()
return &text
},
})
markdownDescription, err := converter.ConvertString(mod.Full_description) markdownDescription, err := converter.ConvertString(mod.Full_description)
if err != nil { if err != nil {