From 2cccb73fb668d6d3a0d465f75677ecf2bffea1d0 Mon Sep 17 00:00:00 2001 From: Endeavorance Date: Tue, 27 May 2025 09:36:10 -0400 Subject: [PATCH] Update readme, add license --- LICENSE | 24 ++++++++++++++++++++++++ README.md | 40 ++++++++++++++++++++++++++++++++++++---- src/index.ts | 11 ++++++----- 3 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..efb9808 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md index c157682..2009ba4 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,50 @@ # 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 Output file path - --template, -t Template file path - --stylesheet, -s Stylesheet file path + --outfile, -o Output path + --outdir, -d Output directory --stdout Force output to stdout + --template, -t Template path (default: _template.html) + --stylesheet, -s Stylesheet path (default: _style.css) + --title, -T 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. diff --git a/src/index.ts b/src/index.ts index 95c5ea9..76dc376 100644 --- a/src/index.ts +++ b/src/index.ts @@ -224,11 +224,12 @@ Usage: echo "some markdown" | buildmd Options: - --outfile, -o Output file path - --outdir, -d Output directory path - --template, -t Template file path - --stylesheet, -s Stylesheet file path - --title, -T Override title in template + --outfile, -o Output path + --outdir, -d Output directory + --stdout Force output to stdout + --template, -t Template path (default: _template.html) + --stylesheet, -s Stylesheet path (default: _style.css) + --title, -T Document title override --help, -h Show this help message `.trim(), );