all repos — vite @ 92f2c4ae813c282dbca8aaa5130050996fe7a77a

a fast (this time, actually) and minimal static site generator

markdown.go (view raw)

 1package main
 2
 3import (
 4	bfc "github.com/Depado/bfchroma"
 5	bf "github.com/russross/blackfriday/v2"
 6)
 7
 8var bfFlags = bf.UseXHTML | bf.Smartypants | bf.SmartypantsFractions |
 9	bf.SmartypantsDashes | bf.NofollowLinks
10var bfExts = bf.NoIntraEmphasis | bf.Tables | bf.FencedCode | bf.Autolink |
11	bf.Strikethrough | bf.SpaceHeadings | bf.BackslashLineBreak |
12	bf.HeadingIDs | bf.Footnotes | bf.NoEmptyLineBeforeBlock
13
14func mdRender(input []byte) []byte {
15	return bf.Run(
16		input,
17		bf.WithRenderer(
18			bfc.NewRenderer(
19				bfc.Style("bw"),
20				bfc.Extend(
21					bf.NewHTMLRenderer(bf.HTMLRendererParameters{
22						Flags: bfFlags,
23					}),
24				),
25			),
26		),
27		bf.WithExtensions(bfExts),
28	)
29}