all repos — vite @ a860def2199b4351ae9e3c2ac0b3a918d28eb7af

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

markdown.go (view 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
package main

import (
	bfc "github.com/Depado/bfchroma"
	bf "github.com/russross/blackfriday/v2"
)

var bfFlags = bf.UseXHTML | bf.Smartypants | bf.SmartypantsFractions |
	bf.SmartypantsDashes | bf.NofollowLinks | bf.FootnoteReturnLinks

func mdRender(input []byte) []byte {
	return bf.Run(
		input,
		bf.WithRenderer(
			bfc.NewRenderer(
				bfc.Style("bw"),
				bfc.Extend(
					bf.NewHTMLRenderer(bf.HTMLRendererParameters{
						Flags: bfFlags,
					}),
				),
			),
		),
	)
}