Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5d2beabc2c
5 changed files with 12 additions and 10 deletions
|
@ -24,7 +24,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
ants "github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
@ -143,7 +142,8 @@ func InstalledIcons() (ret []*Icon) {
|
|||
logging.LogWarnf("read install icon README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
icon.README = gulu.Str.FromBytes(readme)
|
||||
|
||||
icon.README, _ = renderREADME(icon.URL, readme)
|
||||
icon.Outdated = isOutdatedIcon(icon.URL, icon.Version, bazaarIcons)
|
||||
ret = append(ret, icon)
|
||||
}
|
||||
|
|
|
@ -244,16 +244,21 @@ func GetPackageREADME(repoURL, repoHash string, systemID string) (ret string) {
|
|||
}
|
||||
}
|
||||
|
||||
ret, err = renderREADME(repoURL, data)
|
||||
return
|
||||
}
|
||||
|
||||
func renderREADME(repoURL string, mdData []byte) (ret string, err error) {
|
||||
luteEngine := lute.New()
|
||||
luteEngine.SetSoftBreak2HardBreak(false)
|
||||
luteEngine.SetCodeSyntaxHighlight(false)
|
||||
linkBase := repoURL + "/blob/main/"
|
||||
luteEngine.SetLinkBase(linkBase)
|
||||
ret = luteEngine.Md2HTML(string(data))
|
||||
ret = luteEngine.Md2HTML(string(mdData))
|
||||
doc, err := goquery.NewDocumentFromReader(strings.NewReader(ret))
|
||||
if nil != err {
|
||||
logging.LogErrorf("parse HTML failed: %s", err)
|
||||
return ret
|
||||
return
|
||||
}
|
||||
|
||||
doc.Find("a").Each(func(i int, selection *goquery.Selection) {
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
@ -143,7 +142,7 @@ func InstalledTemplates() (ret []*Template) {
|
|||
logging.LogWarnf("read install template README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
template.README = gulu.Str.FromBytes(readme)
|
||||
template.README, _ = renderREADME(template.URL, readme)
|
||||
template.Outdated = isOutdatedTemplate(template.URL, template.Version, bazaarTemplates)
|
||||
ret = append(ret, template)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
ants "github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
@ -146,7 +145,7 @@ func InstalledThemes() (ret []*Theme) {
|
|||
logging.LogWarnf("read install theme README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
theme.README = gulu.Str.FromBytes(readme)
|
||||
theme.README, _ = renderREADME(theme.URL, readme)
|
||||
theme.Outdated = isOutdatedTheme(theme.URL, theme.Version, bazaarThemes)
|
||||
ret = append(ret, theme)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/dustin/go-humanize"
|
||||
ants "github.com/panjf2000/ants/v2"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
|
@ -141,7 +140,7 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
logging.LogWarnf("read install widget README.md failed: %s", readErr)
|
||||
continue
|
||||
}
|
||||
widget.README = gulu.Str.FromBytes(readme)
|
||||
widget.README, _ = renderREADME(widget.URL, readme)
|
||||
widget.Outdated = isOutdatedWidget(widget.URL, widget.Version, bazaarWidgets)
|
||||
ret = append(ret, widget)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue