diff --git a/public/style.css b/public/style.css index c349649..b63372b 100644 --- a/public/style.css +++ b/public/style.css @@ -10,6 +10,9 @@ body.dark { code { word-wrap: break-word; } +summary { + cursor: pointer; +} .dark a { color: #8cb3d9; } diff --git a/routes.go b/routes.go index 4027af0..83e7f97 100644 --- a/routes.go +++ b/routes.go @@ -114,6 +114,8 @@ var funcMap = template.FuncMap{ "humanize": humanize.Time, "markdown": func(host string, body string) template.HTML { var buf bytes.Buffer + re := regexp.MustCompile(`\s---\s`) + body = re.ReplaceAllString(body, "\n***\n") if err := md.Convert([]byte(body), &buf); err != nil { fmt.Println(err) return template.HTML(body) @@ -124,11 +126,11 @@ var funcMap = template.FuncMap{ re := regexp.MustCompile(`href="https:\/\/([a-zA-Z0-9\.\-]+\/(c\/[a-zA-Z0-9]+|(post|comment)\/\d+))`) converted = re.ReplaceAllString(converted, `href="/$1`) } - re := regexp.MustCompile(`href="\/(c\/[a-zA-Z0-9\-]+|(post|comment)\/\d+)`) + re = regexp.MustCompile(`href="\/(c\/[a-zA-Z0-9\-]+|(post|comment)\/\d+)`) converted = re.ReplaceAllString(converted, `href="/`+host+`/$1`) re = regexp.MustCompile(` !([a-zA-Z0-9]+)@([a-zA-Z0-9\.\-]+) `) converted = re.ReplaceAllString(converted, ` !$1@$2 `) - re = regexp.MustCompile(`::: spoiler ([^\n]*)\n([\S\s\n]*):::`) + re = regexp.MustCompile(`::: spoiler (.*?)\n(.*?)\s:::`) converted = re.ReplaceAllString(converted, "
$1$2
") return template.HTML(converted) },