Home

blog @f411a4c7b9f6ed30e37c84c55007044d3b5bf4ed - refs - log -
-
https://git.jolheiser.com/blog.git
My nonexistent blog
goldmark.go - raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package blog

import (
	chromahtml "github.com/alecthomas/chroma/v2/formatters/html"
	"github.com/yuin/goldmark"
	emoji "github.com/yuin/goldmark-emoji"
	highlighting "github.com/yuin/goldmark-highlighting/v2"
	meta "github.com/yuin/goldmark-meta"
	"github.com/yuin/goldmark/extension"
	"github.com/yuin/goldmark/parser"
	"github.com/yuin/goldmark/renderer/html"
)

// Markdown is the default markdown converter
// Set over this variable to alter how the other functions convert
var Markdown = goldmark.New(
	goldmark.WithParserOptions(
		parser.WithAutoHeadingID(),
	),
	goldmark.WithRendererOptions(
		html.WithUnsafe(),
	),
	goldmark.WithExtensions(
		extension.GFM,
		meta.Meta,
		emoji.Emoji,
		highlighting.NewHighlighting(
			highlighting.WithFormatOptions(
				chromahtml.WithClasses(true),
				chromahtml.WithAllClasses(true),
				chromahtml.WithLineNumbers(true),
				chromahtml.WithLinkableLineNumbers(true, "code-"),
			),
		),
	),
)