osdproject
v1.0.0
Published
It's a converter site which converts text and MD format file to HTML files
Downloads
2
Readme
Converter-txtToHtml
Text-to-HTML Converter
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.
Installation
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:
Usage
You can use this tool to convert text files to HTML with various options.
Basic Usage
To convert a single text file to HTML:
node txtToHtml.js <input-file> [options]
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
Additional Features
Title Parsing
- 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.
Default Behavior
- 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 thetil
directory is removed before generating new output.
Examples
Here are some usage examples:
Convert a single text file and specify an output directory
node txtToHtml.js ./example.txt -o ./custom_output
Convert a directory of text files
node txtToHtml.js ./text_files -o ./output
Convert a text file with a specified stylesheet URL
node txtToHtml.js ./example.txt -s https://example.com/styles.css
Convert a text file or Markdown language from any language to CAD English
node txtToHtml.js inputfile.txt -l fr til
License
This project is licensed under the MIT License - see the LICENSE file for details.