all repos — vite @ a52a946d392ee831216565bbfb67acf5d9f20ae3

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

Syntax style is configurable
Anirudh Oppiliappan x@icyphox.sh
Sat, 13 Feb 2021 12:53:02 +0530
commit

a52a946d392ee831216565bbfb67acf5d9f20ae3

parent

0a2b893a2ec830c9de1a0e25555e9068820eef65

3 files changed, 7 insertions(+), 6 deletions(-)

jump to
M build.gobuild.go

@@ -2,13 +2,13 @@ package main

import ( "fmt" - "html/template" "io/ioutil" "os" "os/exec" "path/filepath" "sort" "strings" + "text/template" "github.com/cross-cpm/go-shutil" )

@@ -58,7 +58,7 @@ printErr(err)

} restContent, fm := parseFrontmatter(content) - bodyHtml := mdRender(restContent) + bodyHtml := mdRender(restContent, cfg) relPath, _ := filepath.Rel("pages/", mdPath) var buildPath string

@@ -126,7 +126,7 @@ printErr(err)

} restContent, fm := parseFrontmatter(content) - bodyHtml := mdRender(restContent) + bodyHtml := mdRender(restContent, cfg) fm.Body = string(bodyHtml) var newFm = NewFm{
M config.goconfig.go

@@ -8,7 +8,7 @@

type Config struct { Title string `yaml:"title"` Header string `yaml:"header"` - DateFmt string `yaml:datefmt` + DateFmt string `yaml:"datefmt"` SiteURL string `yaml:"siteurl"` Description string `yaml:"description"` Author map[string]string `yaml:"author"`

@@ -16,6 +16,7 @@ Footer string `yaml:"footer"`

Prebuild []string `yaml:"prebuild"` Postbuild []string `yaml:"postbuild"` RSSPrefixURL string `yaml:"rssprefixurl"` + Syntax string `yaml:"syntax"` } func parseConfig() Config {
M markdown.gomarkdown.go

@@ -11,12 +11,12 @@ var bfExts = bf.NoIntraEmphasis | bf.Tables | bf.FencedCode | bf.Autolink |

bf.Strikethrough | bf.SpaceHeadings | bf.BackslashLineBreak | bf.HeadingIDs | bf.Footnotes | bf.NoEmptyLineBeforeBlock -func mdRender(input []byte) []byte { +func mdRender(input []byte, cfg Config) []byte { return bf.Run( input, bf.WithRenderer( bfc.NewRenderer( - bfc.Style("bw"), + bfc.Style(cfg.Syntax), bfc.Extend( bf.NewHTMLRenderer(bf.HTMLRendererParameters{ Flags: bfFlags,