DEV Community

Cover image for My first Open Source Software
Soham Thaker
Soham Thaker

Posted on • Edited on

My first Open Source Software

Hi all! Wanted to share some exciting news! 🎊🎉 My first ever Open Source Software is released for the public to try and contribute to.

Link to repo: https://github.com/sdthaker/Node-TILify

Node-TILify

Welcome to Node-TILify. An open source CLI software that helps you convert a text file or a directory of text file(s) into html file(s) blazingly fast 🏃‍♂️ 💨 ⚡️. The name of the project was chosen to showcase which language/framework was used to build this tool -- Node.js, what the tool is all about -- TIL - Today I Learned, & the value that it adds to your workflow -- Amplifying Knowledge.

How to use / Installation

Make sure git is installed on your system. Also, make sure you have latest node installed on your computer.

To install this program, first clone the repository by running:

git clone https://github.com/sdthaker/Node-TILify.git
Enter fullscreen mode Exit fullscreen mode

To make sure node & npm are installed on your system, run:

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

You can now run the program from the cloned repository's terminal to see how to use this tool:

node src/index.js -h
Enter fullscreen mode Exit fullscreen mode

Optional - If you'd like to spin up a node server, open a terminal inside of the cloned repository, and install the node dependencies & spin up the server by running:

npm install
npm run start
Enter fullscreen mode Exit fullscreen mode

Features

  • Pass in a txt file and it'll generate an html file.
  • Pass in a directory and it'll search through all the txt files in that directory and generate html files which are then stored in ./til directory.
  • Every paragraph is enclosed with <p> tag.
  • Every hyperlink starting with https:// or http:// is enclosed with <a> tag.
  • Every line that ends in ^ is enclosed in <h2> tag.
  • Optional Feature #1: If the first line of the text has 2 spaces after it, a <title> tag is added to the <head> and a <h1> tag is added at the beginning of <body>.
  • Optional Feature #5: Stylesheet is added to every html file to improve the looks of it.
  • Passing -h or --help command prints help menu.
  • Passing -v or --version command prints version and name of the tool.
  • Optional Feature #2: Passing -o or --output command followed by an output directory path, stores all the generated HTML files to that directory. If no directory exists, it'll create one. It overwrites the content of the files that match with the input file or directory of files and creates a new file if it doesn't exist in the output directory.
  • Name of the generated html file is the same as name of txt file.

Usages / Examples

  • node src/index.js -h / node src/index.js --help - To print help menu
  • node src/index.js -v / node src/index.js --version - To print version and name of the tool
  • node src/index.js input.txt - To read txt file and generate html from it to be stored in ./til directory
  • node src/index.js ./examples - To read txt files from a directory and generate html from it to be stored in ./til directory
  • node src/index.js input.txt -o collection / node src/index.js input.txt -output collection - To read a txt file and generate html from it to be stored in ./collection directory
  • node src/index.js ./examples -o collection / node src/index.js ./examples --output collection - To read txt files from a directory and generate html from it to be stored in ./collection directory

Top comments (0)