static markdown compiler

Casey DeLorme 434c4f90c9 add git modules 4 mesiacov pred
cmd 31e7409c9f add title to `smd` options 7 rokov pred
templates 8edef6e678 add javascript to book template to generate navigation 7 rokov pred
.gitignore 7f2dd5ac4c rename command to smd 7 rokov pred
go.mod 434c4f90c9 add git modules 4 mesiacov pred
go.sum 434c4f90c9 add git modules 4 mesiacov pred
license 4b409534fd switch to zlib license 7 rokov pred
markdown.go c1b6ae4dc7 update static library code to be much simpler 7 rokov pred
markdown_test.go c1b6ae4dc7 update static library code to be much simpler 7 rokov pred
readme.md 19408daa43 fix main smd command implementation 7 rokov pred
static.go c1b6ae4dc7 update static library code to be much simpler 7 rokov pred
static_test.go c1b6ae4dc7 update static library code to be much simpler 7 rokov pred
templates.go 8edef6e678 add javascript to book template to generate navigation 7 rokov pred

readme.md

GoDoc

static

An abstraction ontop of blackfriday for the purpose of accepting a folder of files and generating html in lexical order with built-in templates.

The primary objective of this project was originally self-education. The result is a sub-par utility with minimal features. The only benefits it offers are a significantly smaller code base, and no meta-data dependencies.

usage

To import the library:

import "github.com/cdelorme/static"

notes

Relative path support has been removed because raw markdown is intended to be readable.

Automatic navigation has been removed from the web solution, since the requirements vary by website and are entirely different when generating a book. Use the template override feature to create your own.

The code makes no assumptions about what index name is used, since that is entirely controlled by the web server.

The library is not concurrently safe, because there are zero benefits to running it concurrently. Everything is bottlenecked at the hard drive, and that cannot be addressed without proper buffered solutions to both markdown and template parsing.

It uses go-bindata to embed default templates, which have been committed to the project since go generate is not possible to do from go get.

No efforts have been made to optimize re-execution around existing files, but it would be possible to compare the markdown file modified time against the modified time of existing html files to reduce overhead in the future.

If two files with alternative markdown extensions but identical base names exist, the first match is the only one that will be parsed into an html file.

The book mode provides automatically generated navigation using javascript.

Any absolute links in book mode will not function as desired.

All tests have been (re) written using a black-box approach, where only publicly exposed functions and properties are modified.

references