+3
appview/pages/funcmap.go
+3
appview/pages/funcmap.go
+28
appview/pages/markdown.go
+28
appview/pages/markdown.go
···
1
+
package pages
2
+
3
+
import (
4
+
"bytes"
5
+
6
+
"github.com/yuin/goldmark"
7
+
"github.com/yuin/goldmark/extension"
8
+
"github.com/yuin/goldmark/parser"
9
+
"github.com/yuin/goldmark/renderer/html"
10
+
)
11
+
12
+
func renderMarkdown(source string) string {
13
+
md := goldmark.New(
14
+
goldmark.WithExtensions(extension.GFM),
15
+
goldmark.WithParserOptions(
16
+
parser.WithAutoHeadingID(),
17
+
),
18
+
goldmark.WithRendererOptions(
19
+
html.WithHardWraps(),
20
+
html.WithXHTML(),
21
+
),
22
+
)
23
+
var buf bytes.Buffer
24
+
if err := md.Convert([]byte(source), &buf); err != nil {
25
+
return source
26
+
}
27
+
return buf.String()
28
+
}
+2
-2
appview/pages/templates/repo/issues/issue.html
+2
-2
appview/pages/templates/repo/issues/issue.html
···
42
42
43
43
{{ if .Issue.Body }}
44
44
<article id="body" class="mt-8">
45
-
{{ .Issue.Body | escapeHtml }}
45
+
{{ .Issue.Body | markdown }}
46
46
</article>
47
47
{{ end }}
48
48
</section>
···
83
83
</a>
84
84
</div>
85
85
<div class="">
86
-
{{ nl2br .Body }}
86
+
{{ .Body | markdown }}
87
87
</div>
88
88
</div>
89
89
{{ end }}
+1
go.mod
+1
go.mod
+1
go.sum
+1
go.sum
···
263
263
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
264
264
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
265
265
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
266
+
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
266
267
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
267
268
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA=
268
269
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8=