cdelorme c1b6ae4dc7 update static library code to be much simpler | 7 anni fa | |
---|---|---|
.. | ||
main.go | 7 anni fa | |
main_test.go | 7 anni fa | |
readme.md | 7 anni fa |
This is the cli implementation and interface to the static library for generating html from markdown.
There are far better tools written in a variety of languages which offer more features and better support. However they may also impose a runtime, special configuration, or special syntax:
So, while the purpose of this project was self-education, what it provides is a very compact tool with minimal third party dependencies and no special requirements for configuration or syntax, wrapped in under 700 lines of code (including tests and comments).
This project assumes the following behaviors:
public/
for the output pathMost of these default behaviors can be overridden with command line parameters.
The only required parameter is the path to a template file. An example has been included with the project.
If run within a repository it will attempt to grab a short-hash for the version, otherwise it generates a unix timestamp.
It assumes the index files are index.html
. If no match is found then no table of contents is created and no references to that folder will be created at the parent either even if it contains other markdown files.
Currently it attempts to generate multiple pages in parallel.
Install the utility:
go get -u github.com/cdelorme/staticmd/...
The utility has builtin help to assist with using it:
staticmd help
Logging is completely controlled by the LOG_LEVEL
environment variable, which accepts standard syslog severities with a default of error
(use silent
to turn off output).
You can use it to generate a single-page document that can be printed as a PDF and distributed with ease:
staticmd -t template.tmpl -s -c src/
This will generate a single file inside src/
.
This code has unit tests that can easily be executed:
LOG_LEVEL=silent go test -v -race -cover