buildmd - Build markdown files to html with templates and metadata
Find a file
2025-05-27 09:38:42 -04:00
demo Add support for multiple inputs 2025-05-27 08:09:34 -04:00
src Update readme, add license 2025-05-27 09:38:42 -04:00
.gitignore Initial commit 2025-05-23 16:05:45 -04:00
biome.json Initial commit 2025-05-24 13:19:39 -04:00
bun.lock Initial commit 2025-05-24 13:19:39 -04:00
LICENSE Update readme, add license 2025-05-27 09:38:42 -04:00
package.json Initial commit 2025-05-24 13:19:39 -04:00
README.md Update readme, add license 2025-05-27 09:38:42 -04:00
tsconfig.json Initial commit 2025-05-24 13:19:39 -04:00

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 simple HTML files as templates, replacing instances of %key% with the value of key in the metadata of the document.

By default, buildmd will look for a _template.html file in the current working directory, unless an alternate template is specified with the --template or -t option.

The following metadata is available by default:

  • 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 for use in the template. Properties defined in frontmatter take precedence over the default metadata.

If no template file is discovered, buildmd will inject a default template that includes the stylesheet, title, and content in well-structured HTML.

Styles

buildmd will automatically look for a _style.css file in the current working directory, unless an alternate stylesheet is specified with the --stylesheet or -s option. The contents of the discovered stylesheet file will be available in the template as %stylesheet%.

In the event that no stylesheet is found, buildmd will inject a default stylesheet.