Home

blog @c860d4e60904f3fb2996e9ef9046ae8f2d8d7732 - refs - log -
-
https://git.jolheiser.com/blog.git
My nonexistent blog
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
package blog

import (
	"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"
)

// 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.WithExtensions(
		extension.GFM,
		meta.Meta,
		emoji.Emoji,
		highlighting.NewHighlighting(
			highlighting.WithFormatOptions(
				html.WithClasses(true),
				html.WithLineNumbers(true),
				html.WithLinkableLineNumbers(true, "code-"),
				html.LineNumbersInTable(true),
			),
		),
	),
)