Update readme, add license
This commit is contained in:
parent
aff3fb81a1
commit
2cccb73fb6
3 changed files with 66 additions and 9 deletions
24
LICENSE
Normal file
24
LICENSE
Normal file
|
@ -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 <https://unlicense.org/>
|
40
README.md
40
README.md
|
@ -1,18 +1,50 @@
|
||||||
# buildmd
|
# buildmd
|
||||||
|
|
||||||
|
Build markdown files to html
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
buildmd - Build markdown files to html with templates and metadata
|
buildmd - Build markdown files to html with templates and metadata
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
buildmd file.md
|
buildmd file.md
|
||||||
buildmd file.md -o output.html
|
buildmd file.md -o output.html
|
||||||
|
buildmd ./src/*.md --outdir public
|
||||||
echo "some markdown" | buildmd
|
echo "some markdown" | buildmd
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--outfile, -o <file> Output file path
|
--outfile, -o <file> Output path
|
||||||
--template, -t <file> Template file path
|
--outdir, -d <dir> Output directory
|
||||||
--stylesheet, -s <file> Stylesheet file path
|
|
||||||
--stdout Force output to stdout
|
--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
|
--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.
|
||||||
|
|
11
src/index.ts
11
src/index.ts
|
@ -224,11 +224,12 @@ Usage:
|
||||||
echo "some markdown" | buildmd
|
echo "some markdown" | buildmd
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--outfile, -o <file> Output file path
|
--outfile, -o <file> Output path
|
||||||
--outdir, -d <dir> Output directory path
|
--outdir, -d <dir> Output directory
|
||||||
--template, -t <file> Template file path
|
--stdout Force output to stdout
|
||||||
--stylesheet, -s <file> Stylesheet file path
|
--template, -t <file> Template path (default: _template.html)
|
||||||
--title, -T <string> Override title in template
|
--stylesheet, -s <file> Stylesheet path (default: _style.css)
|
||||||
|
--title, -T <string> Document title override
|
||||||
--help, -h Show this help message
|
--help, -h Show this help message
|
||||||
`.trim(),
|
`.trim(),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue