This is a program that I use as a templating "engine" for the notes on my website.
All tmpl
does is it reads a directory with Markdown files (which may include a YAML frontmatter), maps each .md
file to a Note
struct, reads the HTML templates defined in the provided file, and finally generates HTML files along with a CSS file for syntax highlighting in code blocks.
Here's how I use it to generate the HTML for my notes
:
./tmpl --output ./public --templates ./src/templates.html notes
This is a minimal replacement for static site generators such as hugo.
I sat down to write this thinking it's gonna be difficult, but thanks to go's excellent html/template pkg, and packages like goldmark and chroma, it was too damn easy ยฏ\(ใ)/ยฏ.
read the (ugly) code and see for yourself.