A basic Static Site Generator that converts .txt files to .html files. Current release 0.1 with the following features.
- (Required) Allows the user to specify an input file or folder to be processed.
- Allows the input to be a deep tree of files and folders, all .txt files are recursively parsed.
- Parsed titles (if any) from input files.
- Allows specification of a different output directory
- Allows specification of a stylesheet through linking a stylesheet URL
- Automatically generates an index.html file with relative links to each of the generated html files
- Markdown support: header(1,2,3), link, bold text, italic text, inline code, horizontal rule
-v, --version Displays tool name and current version
-i, --input <file or directory name> Designate an input file or directory
-o, --output <directory name> Designate an output directory, default ./dist
-s, --stylesheet <stylesheet URL> Link a stylesheet URL to the html
-h, --help Lists all available options
Note, this release has not yet been published on npm.
In terminal or console, head to the main sitegen directory and call
npm install -g
Commander: npm install commander
sitegen -v or sitegen --version will display the tool name and current version.
Name: sitegen
Version: 0.1.0
sitegen -h or sitegen --help will list the tool options as listed above.
sitegen -i filename
sitegen --input "directory name"
sitegen -i relative-or-absolute-path-to-file-or-directory
This is the main processing option for the site generator tool.
The file or directory name must follow the input option.
In the case of spaces in file or directory names, quotation marks "" are needed to wrap around the name.
Sample code for using output and stylesheet options below:
sitegen -i filename -o relative-or-absolute-path-directory
sitegen -i filename -s "stylesheet url"
sitegen -i filename -o relative-or-absolute-path-directory -s "stylesheet url"
sitegen -s "stylesheet url" -i filename -o relative-or-absolute-path-directory
The order for using options doesn't matter, but the file, directory or url has to follow the used option.
In the case that an output directory isn't indicated or valid, the generator will create files in a default ./dist folder in the current working directory.
The tool supports Markdown (.md) files.
# H1
## H2
## H3
[I'm an inline-style link](https://github.com)
**bold text**
**italic text**
***bold and italic text***
`This is an inline code`
Three or more "---"
| Markdown syntax | HTML equivalent |
|---|---|
| Header 1 | <h1>Test</h1> |
| Header 2 | <h2>Test</h2> |
| Header 3 | <h3>Test</h3> |
| Bold | <b>Test</b> |
| Italic | <i>Test</i> |
| Link | <a href='URL'>Test</a> |
| Inline Code | <code>Test</code> |
| Horizontal Rule | <hr> |