feat/multi-repo
 1package main
 2
 3import (
 4	"html/template"
 5
 6	"github.com/alecthomas/chroma/v2/formatters/html"
 7	"github.com/yuin/goldmark"
 8	highlighting "github.com/yuin/goldmark-highlighting/v2"
 9	"github.com/yuin/goldmark/extension"
10	"github.com/yuin/goldmark/parser"
11	gmhtml "github.com/yuin/goldmark/renderer/html"
12
13	"github.com/antonmedv/gitmal/pkg/templates"
14)
15
16func createMarkdown(style string) goldmark.Markdown {
17	return goldmark.New(
18		goldmark.WithExtensions(
19			extension.GFM,
20			extension.Typographer,
21			highlighting.NewHighlighting(
22				highlighting.WithStyle(style),
23				highlighting.WithFormatOptions(
24					html.WithClasses(true),
25				),
26			),
27		),
28		goldmark.WithParserOptions(
29			parser.WithAutoHeadingID(),
30		),
31		goldmark.WithRendererOptions(
32			gmhtml.WithUnsafe(),
33		),
34	)
35}
36
37func cssMarkdown(dark bool) template.CSS {
38	return template.CSS(templates.CSSMarkdownLight + "\n@media (prefers-color-scheme: dark) {\n" + templates.CSSMarkdownDark + "\n}\n")
39}