DEV Community

Katie Liu
Katie Liu

Posted on • Updated on

go-go-web - My txt to html converter!

I have a released my first open source app, a command-line tool written in Python which converts .txt file(s) to .html. This is my first step to creating a full-fledged static site generator!

In my first release v0.0.1, the tool is capable of:

  • converting TIL posts written in a .txt file or a folder of .txt files to .html
  • specifying the output folder
  • specifying the url of a css stylesheet

GitHub Repo

Installation

  1. Download and install the latest version of python

  2. Open a terminal and navigate to where you want go-go-web to be stored. Clone this repository locally

git clone https://github.com/kliu57/go-go-web.git
cd go-go-web
Enter fullscreen mode Exit fullscreen mode
  1. Check that you have the latest version of the app.
python convert.py --version
Enter fullscreen mode Exit fullscreen mode

Usage

Convert .txt to .html

python convert.py -i <file or folder path>
Enter fullscreen mode Exit fullscreen mode
# Example (Convert one file)
python convert.py -i ./examples/til_post1.txt
Enter fullscreen mode Exit fullscreen mode
# Example (Convert a folder of files)
python convert.py -i ./examples
Enter fullscreen mode Exit fullscreen mode
  • Output(s) can be found in til folder

Specify Output Location

python convert.py -i <file or folder path> -o <folder path>
Enter fullscreen mode Exit fullscreen mode
# Example
python convert.py -i ./examples/examples.txt -o ./examples
Enter fullscreen mode Exit fullscreen mode

Specify Stylesheet

python convert.py -i <file or folder path> -s <stylesheet url>
Enter fullscreen mode Exit fullscreen mode
# Example
python convert.py -i ./examples/til_post2.txt -s https://cdnjs.cloudflare.com/ajax/libs/tufte-css/1.8.0/tufte.min.css
Enter fullscreen mode Exit fullscreen mode

View App Version

python convert.py --version` or `python convert.py -v
Enter fullscreen mode Exit fullscreen mode

View Usage Message

python convert.py --help` or `python convert.py -h
Enter fullscreen mode Exit fullscreen mode

Top comments (0)