mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
🎨 Improve local image rendering in README of installed marketplace packages https://github.com/siyuan-note/siyuan/issues/14502
This commit is contained in:
parent
7ab4ccf991
commit
4b27f131ca
6 changed files with 20 additions and 9 deletions
|
|
@ -42,7 +42,7 @@ import (
|
|||
|
||||
type DisplayName struct {
|
||||
Default string `json:"default"`
|
||||
ArSA string `json:"ar_SA"`
|
||||
ArSA string `json:"ar_SA"`
|
||||
DeDE string `json:"de_DE"`
|
||||
EnUS string `json:"en_US"`
|
||||
EsES string `json:"es_ES"`
|
||||
|
|
@ -58,7 +58,7 @@ type DisplayName struct {
|
|||
|
||||
type Description struct {
|
||||
Default string `json:"default"`
|
||||
ArSA string `json:"ar_SA"`
|
||||
ArSA string `json:"ar_SA"`
|
||||
DeDE string `json:"de_DE"`
|
||||
EnUS string `json:"en_US"`
|
||||
EsES string `json:"es_ES"`
|
||||
|
|
@ -74,7 +74,7 @@ type Description struct {
|
|||
|
||||
type Readme struct {
|
||||
Default string `json:"default"`
|
||||
ArSA string `json:"ar_SA"`
|
||||
ArSA string `json:"ar_SA"`
|
||||
DeDE string `json:"de_DE"`
|
||||
EnUS string `json:"en_US"`
|
||||
EsES string `json:"es_ES"`
|
||||
|
|
@ -172,7 +172,7 @@ func getPreferredReadme(readme *Readme) string {
|
|||
case "ar_SA":
|
||||
if "" != readme.ArSA {
|
||||
ret = readme.ArSA
|
||||
}
|
||||
}
|
||||
case "de_DE":
|
||||
if "" != readme.DeDE {
|
||||
ret = readme.DeDE
|
||||
|
|
@ -688,6 +688,17 @@ func renderREADME(repoURL string, mdData []byte) (ret string, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func renderLocalREADME(basePath string, mdData []byte) (ret string, err error) {
|
||||
luteEngine := lute.New()
|
||||
luteEngine.SetSoftBreak2HardBreak(false)
|
||||
luteEngine.SetCodeSyntaxHighlight(false)
|
||||
linkBase := basePath
|
||||
luteEngine.SetLinkBase(linkBase)
|
||||
ret = luteEngine.Md2HTML(string(mdData))
|
||||
ret = util.LinkTarget(ret, linkBase)
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
packageLocks = map[string]*sync.Mutex{}
|
||||
packageLocksLock = sync.Mutex{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue