osd-sitegen v1.0.2
OSD-SiteGen
About
A basic Static Site Generator that converts .txt and .md files to .html files.
Current release 1.0.0 on npm with the following features.
Features
- Allows the user to specify an input file or input folder to be processed.
- Allows the input to be a deep tree of files and folders, all
.txtand.mdfiles are recursively parsed. - Parsed titles (if any) from input
.txtfiles. - Allows specification of a different output directory. If there's no directory specified, a
distfolder will be created in the current working directory to store the generatedhtmlfile(s). - 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: Full markdown support through Remarkable
- Supports parsing of config JSON files containing SSG options
Development
For interest in developments please read CONTRIBUTING.md
Installation
- Make sure you have npm installed
- Please make sure you have the latest version of Node ("v16.13.0")
- run the following in terminal or command line
npm install -g osd-sitegenHead to any directory you wish for the default /dist folder to be generated in, then run the tool options below.
To uninstall run
npm uninstall -g osd-sitegenTool options
-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
-c, --config <file> Read and parse json properties from file as options.
-h, --help Lists all available optionsVersion option example
osd-sitegen -v or osd-sitegen --version will display the tool name and current version.
Name: osd-sitegen
Version: 1.0.0Help option example
osd-sitegen -h or osd-sitegen --help will list the tool options as listed above.
Input option examples
osd-sitegen -i filename
osd-sitegen --input "directory name"
osd-sitegen -i relative-or-absolute-path-to-file-or-directoryThis is the main processing option for the site generator tool.
In the case of spaces in file or directory names, quotation marks "" are needed to wrap around the name.
Output and Stylesheet option examples
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-directoryIn 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.
Markdown
The tool supports Markdown (.md) files with full Markdown support from Remarkable
Config file:
The tool supports .json config file
Usage
osd-sitegen -c config.jsonReading and parsing json properties as options for osd-sitegen
Note: if -c exists, other options will be ignored.
Example.json
{
"input": "./testfiles",
"output": "./output",
"stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css",
"lang": "en"
}