Casey DeLorme 434c4f90c9 add git modules | 4 mesiacov pred | |
---|---|---|
cmd | 7 rokov pred | |
templates | 7 rokov pred | |
.gitignore | 7 rokov pred | |
go.mod | 4 mesiacov pred | |
go.sum | 4 mesiacov pred | |
license | 7 rokov pred | |
markdown.go | 7 rokov pred | |
markdown_test.go | 7 rokov pred | |
readme.md | 7 rokov pred | |
static.go | 7 rokov pred | |
static_test.go | 7 rokov pred | |
templates.go | 7 rokov pred |
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.
To import the library:
import "github.com/cdelorme/static"
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.