in img path switched assets with static
This commit is contained in:
parent
9c7e309ec6
commit
c8c1155fb8
|
@ -2,6 +2,7 @@ package mdparser
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -60,7 +61,14 @@ func parseMd(line string, title *string, text *string, img *string) (bool, compo
|
||||||
|
|
||||||
} else if char == "!" {
|
} else if char == "!" {
|
||||||
rgx := regexp.MustCompile(`\((.*?)\)`)
|
rgx := regexp.MustCompile(`\((.*?)\)`)
|
||||||
*img = rgx.FindStringSubmatch(line)[1]
|
mdImage := rgx.FindStringSubmatch(line)[1]
|
||||||
|
mdImage = strings.TrimSpace(mdImage)
|
||||||
|
|
||||||
|
if mdImage[:4] != "http" {
|
||||||
|
mdImage = strings.Replace(mdImage, "assets", "static", 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
*img = mdImage
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
*text += line
|
*text += line
|
||||||
|
|
Loading…
Reference in New Issue