This command-line tool converts plain text files into valid HTML5 files. It can process single text files or all text files within a directory.
Before using this tool, make sure you have Node.js installed on your system.
-
Clone or download this repository to your local machine.
-
Open your terminal or command prompt and navigate to the project directory.
-
Install the required dependencies by running:
You can use this tool to convert text files to HTML with various options.
To convert a single text file to HTML:
node txtToHtml.js <input-file> [options]-
-o, --output <output-directory>: Specify the output directory for the generated HTML files. If not specified, the default is./til.Example:
node txtToHtml.js ./example.txt -o ./output_folder-c,--config: specify the file path to a TOML-based config file
- If your input file contains a title, it should be the first line followed by two blank lines. The title will be used as the
<title>and as an<h1>element in the HTML file.
- By default, the tool creates an output directory named
til(short for "text-to-HTML") in the current directory to store the generated HTML files. Existing content in thetildirectory is removed before generating new output.
Here are some usage examples:
Convert a single text file and specify an output directory
node txtToHtml.js ./example.txt -o ./custom_outputConvert a directory of text files
node txtToHtml.js ./text_files -o ./outputConvert a text file with a specified stylesheet URL
node txtToHtml.js ./example.txt -s https://example.com/styles.cssConvert a text file or Markdown language from any language to CAD English
node txtToHtml.js inputfile.txt -l fr tilThis project is licensed under the MIT License - see the LICENSE file for details.