55 lines
1.8 KiB
Markdown
55 lines
1.8 KiB
Markdown
# buildmd
|
|
|
|
Build markdown files to html
|
|
|
|
## Usage
|
|
|
|
```
|
|
buildmd - Build markdown files to html with templates and metadata
|
|
|
|
Usage:
|
|
buildmd file.md
|
|
buildmd file.md -o output.html
|
|
buildmd ./src/*.md --outdir public
|
|
echo "some markdown" | buildmd
|
|
|
|
Options:
|
|
--outfile, -o <file> Output path
|
|
--outdir, -d <dir> Output directory
|
|
--stdout Force output to stdout
|
|
--template, -t <file> Template path (default: _template.html)
|
|
--stylesheet, -s <file> Stylesheet path (default: _style.css)
|
|
--title, -T <string> Document title override
|
|
--help, -h Show this help message
|
|
```
|
|
|
|
## Templates
|
|
|
|
`buildmd` uses HTML files as templates. Instances of `%key%` are replaced with value of `key` from the built document.
|
|
|
|
You can provide a template path with the `--template` or `-t` flag. If no template flag is provided, `buildmd`
|
|
will look for a `_template.html` file in the current directory. If no template file is found, a simple
|
|
default template will be used.
|
|
|
|
## Stylesheets
|
|
|
|
`buildmd` supports custom stylesheets. You can specify a stylesheet with the `--stylesheet` or `-s` flag.
|
|
|
|
If no stylesheet is specified, `buildmd` will look for a `_style.css` file in the current directory.
|
|
|
|
If no stylesheet is found, a default stylesheet will be used.
|
|
|
|
## Data
|
|
|
|
The following keys are always available in the template data:
|
|
|
|
- `title`: The title of the document
|
|
- `content`: The rendered markdown content
|
|
- `stylesheet`: The document css styles
|
|
- `timestamp`: An ISO string representing when the build occurred
|
|
- `datetime` A localized string representing when the build occurred
|
|
|
|
Additionally, any data defined in YAML frontmatter in the markdown file
|
|
will be available in the template. Properties defined in frontmatter
|
|
take precedence over the default metadata.
|
|
|