static-site-converter
v1.0.3
Published
txt-to-html static site generater
Readme
Goal
This is mainly a tool that converts TXT files into static web pages. Additionally, Markdown(MD) files will also get converted into HTML. Any bold text in the MD file will also appear bold in the HTML file. Also, any --- or longer variations from Markdown files will become horizontal rule/line in the HTML files.
Any link syntax (such as [text](link)) in Markdown files will be converted into a HTML link.
If you have a static folder under the input folder directory specified via command, all fo its content will be copied to the static folder in the output directory (defualt: dist folder in your current directory).
Getting Started
Please first have Node.js installed on your machine.
- While inside an empty folder, download the tool via command
npm i static-site-converterin command line (such as cmd or PowerShell) - Run command
cd node_modules\static-site-converterto get into the tool's root folder - You can now use it! See the next Usage section for more details
Usage
The user can provide one or more TXT/MD files to convert into HTML file(s) of the same names. Sample test files are in "test_files" folder. This tool is run by entering commands in command line.
Use --input or -i to specify path to a TXT/MD file or a folder with TXT/MD files, and this tool will convert them into HTML files in 'dist' folder.
If the dist folder doesn't exist at the current directory, one will be created. If it exist, it will be deleted first to clean old output before being recreated.
Example: node index -i ./test_files
If you path has spaces for a file or folder, please use '' around the name(s).
Example: node index -i ./'a folder with space in the name'
Other options:
--versionor-vThis provides tool name and its version.--outputor-oUse this to specify an output directory instead of using the dist folder. If the directory is invalid, output directory is set back to the default dist folder. Note: For safety, the directory specified by this option is never deleted by the tool! Example:-o ./myFolder--stylesheetor-sUse this to specify url of the stylesheet to use. Example:-s https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/tufte.min.css--helpor-hThis shows the help guide.--langor-lUse this to specify the language of the HTML files. Example:-l frfor French--configor-cUse this to specify JSON config file that has a list of options. If the same option is provided in config file and command line argument, the command line argument will be overridden. Example:-c ./config_file/ssg-config.jsonfor below options to be added. config.json
{
"input": "./test_files",
"output": "./out",
"stylesheet": "https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/tufte.min.css",
"lang": "fr-CA",
"future-feature": "invalid option will be ignored"
}Contributing
Please see CONTRIBUTING.md.
