Signed-off-by: oppiliappan me@oppi.li
+20
-1
appview/pages/markup/markdown.go
+20
-1
appview/pages/markup/markdown.go
···
5
"bytes"
6
"fmt"
7
"io"
8
"net/url"
9
"path"
10
"regexp"
11
"strings"
12
13
"github.com/microcosm-cc/bluemonday"
14
"github.com/yuin/goldmark"
15
"github.com/yuin/goldmark/ast"
16
"github.com/yuin/goldmark/extension"
17
"github.com/yuin/goldmark/parser"
···
50
51
func (rctx *RenderContext) RenderMarkdown(source string) string {
52
md := goldmark.New(
53
-
goldmark.WithExtensions(extension.GFM),
54
goldmark.WithParserOptions(
55
parser.WithAutoHeadingID(),
56
),
···
202
policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")
203
policy.AllowAttrs("checked", "disabled", "data-source-position").OnElements("input")
204
205
// centering content
206
policy.AllowElements("center")
207
···
5
"bytes"
6
"fmt"
7
"io"
8
+
"maps"
9
"net/url"
10
"path"
11
"regexp"
12
+
"slices"
13
"strings"
14
15
+
"github.com/alecthomas/chroma/v2"
16
+
chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
17
+
"github.com/alecthomas/chroma/v2/styles"
18
"github.com/microcosm-cc/bluemonday"
19
"github.com/yuin/goldmark"
20
+
highlighting "github.com/yuin/goldmark-highlighting/v2"
21
"github.com/yuin/goldmark/ast"
22
"github.com/yuin/goldmark/extension"
23
"github.com/yuin/goldmark/parser"
···
56
57
func (rctx *RenderContext) RenderMarkdown(source string) string {
58
md := goldmark.New(
59
+
goldmark.WithExtensions(
60
+
extension.GFM,
61
+
highlighting.NewHighlighting(
62
+
highlighting.WithFormatOptions(
63
+
chromahtml.Standalone(false),
64
+
chromahtml.WithClasses(true),
65
+
),
66
+
highlighting.WithCustomStyle(styles.Get("catppuccin-latte")),
67
+
),
68
+
),
69
goldmark.WithParserOptions(
70
parser.WithAutoHeadingID(),
71
),
···
217
policy.AllowAttrs("type").Matching(regexp.MustCompile(`^checkbox$`)).OnElements("input")
218
policy.AllowAttrs("checked", "disabled", "data-source-position").OnElements("input")
219
220
+
// for code blocks
221
+
policy.AllowAttrs("class").Matching(regexp.MustCompile(`chroma`)).OnElements("pre")
222
+
policy.AllowAttrs("class").Matching(regexp.MustCompile(strings.Join(slices.Collect(maps.Values(chroma.StandardTypes)), "|"))).OnElements("span")
223
+
224
// centering content
225
policy.AllowElements("center")
226
+3
-2
go.mod
+3
-2
go.mod
···
22
github.com/go-enry/go-enry/v2 v2.9.2
23
github.com/go-git/go-git/v5 v5.14.0
24
github.com/google/uuid v1.6.0
25
github.com/gorilla/sessions v1.4.0
26
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
27
github.com/hiddeco/sshsig v0.2.0
···
38
github.com/stretchr/testify v1.10.0
39
github.com/urfave/cli/v3 v3.3.3
40
github.com/whyrusleeping/cbor-gen v0.3.1
41
-
github.com/yuin/goldmark v1.4.13
42
golang.org/x/crypto v0.40.0
43
golang.org/x/net v0.42.0
44
golang.org/x/sync v0.16.0
···
88
github.com/golang/mock v1.6.0 // indirect
89
github.com/google/go-querystring v1.1.0 // indirect
90
github.com/gorilla/css v1.0.1 // indirect
91
-
github.com/gorilla/feeds v1.2.0 // indirect
92
github.com/gorilla/securecookie v1.1.2 // indirect
93
github.com/hashicorp/errwrap v1.1.0 // indirect
94
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
···
22
github.com/go-enry/go-enry/v2 v2.9.2
23
github.com/go-git/go-git/v5 v5.14.0
24
github.com/google/uuid v1.6.0
25
+
github.com/gorilla/feeds v1.2.0
26
github.com/gorilla/sessions v1.4.0
27
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
28
github.com/hiddeco/sshsig v0.2.0
···
39
github.com/stretchr/testify v1.10.0
40
github.com/urfave/cli/v3 v3.3.3
41
github.com/whyrusleeping/cbor-gen v0.3.1
42
+
github.com/yuin/goldmark v1.4.15
43
+
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
44
golang.org/x/crypto v0.40.0
45
golang.org/x/net v0.42.0
46
golang.org/x/sync v0.16.0
···
90
github.com/golang/mock v1.6.0 // indirect
91
github.com/google/go-querystring v1.1.0 // indirect
92
github.com/gorilla/css v1.0.1 // indirect
93
github.com/gorilla/securecookie v1.1.2 // indirect
94
github.com/hashicorp/errwrap v1.1.0 // indirect
95
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
+5
-1
go.sum
+5
-1
go.sum
···
79
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
80
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
81
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
82
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
83
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
84
github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw=
···
429
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
430
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
431
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
432
-
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
433
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
434
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA=
435
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8=
436
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q=
···
79
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
80
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
81
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
82
+
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
83
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
84
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
85
github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw=
···
430
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
431
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
432
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
433
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
434
+
github.com/yuin/goldmark v1.4.15 h1:CFa84T0goNn/UIXYS+dmjjVxMyTAvpOmzld40N/nfK0=
435
+
github.com/yuin/goldmark v1.4.15/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
436
+
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ=
437
+
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc/go.mod h1:ovIvrum6DQJA4QsJSovrkC4saKHQVs7TvcaeO8AIl5I=
438
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b h1:CzigHMRySiX3drau9C6Q5CAbNIApmLdat5jPMqChvDA=
439
gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b/go.mod h1:/y/V339mxv2sZmYYR64O07VuCpdNZqCTwO8ZcouTMI8=
440
gitlab.com/yawning/tuplehash v0.0.0-20230713102510-df83abbf9a02 h1:qwDnMxjkyLmAFgcfgTnfJrmYKWhHnci3GjDqcZp1M3Q=
+1
-2
input.css
+1
-2
input.css
+5
-2
nix/gomod2nix.toml
+5
-2
nix/gomod2nix.toml
···
426
version = "v0.3.1"
427
hash = "sha256-PAd8M2Z8t6rVRBII+Rg8Bz+QaJIwbW64bfyqsv31kgc="
428
[mod."github.com/yuin/goldmark"]
429
-
version = "v1.4.13"
430
-
hash = "sha256-GVwFKZY6moIS6I0ZGuio/WtDif+lkZRfqWS6b4AAJyI="
431
[mod."gitlab.com/yawning/secp256k1-voi"]
432
version = "v0.0.0-20230925100816-f2616030848b"
433
hash = "sha256-X8INg01LTg13iOuwPI3uOhPN7r01sPZtmtwJ2sudjCA="
···
426
version = "v0.3.1"
427
hash = "sha256-PAd8M2Z8t6rVRBII+Rg8Bz+QaJIwbW64bfyqsv31kgc="
428
[mod."github.com/yuin/goldmark"]
429
+
version = "v1.4.15"
430
+
hash = "sha256-MvSOT6dwf5hVYkIg4MnqMpsy5ZtWZ7amAE7Zo9HkEa0="
431
+
[mod."github.com/yuin/goldmark-highlighting/v2"]
432
+
version = "v2.0.0-20230729083705-37449abec8cc"
433
+
hash = "sha256-HpiwU7jIeDUAg2zOpTIiviQir8dpRPuXYh2nqFFccpg="
434
[mod."gitlab.com/yawning/secp256k1-voi"]
435
version = "v0.0.0-20230925100816-f2616030848b"
436
hash = "sha256-X8INg01LTg13iOuwPI3uOhPN7r01sPZtmtwJ2sudjCA="
+1
-3
tailwind.config.js
+1
-3
tailwind.config.js
···
36
css: {
37
maxWidth: "none",
38
pre: {
39
-
backgroundColor: colors.gray[100],
40
-
color: colors.black,
41
-
"@apply font-normal text-black bg-gray-100 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 dark:border": {},
42
},
43
code: {
44
"@apply font-normal font-mono p-1 rounded text-black bg-gray-100 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700": {},
···
36
css: {
37
maxWidth: "none",
38
pre: {
39
+
"@apply font-normal text-black bg-gray-100 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 border": {},
40
},
41
code: {
42
"@apply font-normal font-mono p-1 rounded text-black bg-gray-100 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700": {},