DEV Community

Oliver Pham
Oliver Pham

Posted on

Static Site Generator for Text Files: Release 0.1 Note

Static site generator (SSG) is undoubtedly one of the trending web development technologies in the last few years. There are already hundreds of them out there.

However, I'd like to contribute a minimal SSG for text files to the open source community. I believe this is a wonderful opportunity to learn about SSG.

Without further ado...

Silkie

Static site generator with the smoothness of silk

Silkie is a simple and smooth static site generator. It can parse text files (".txt" files) and generate HTML files from them.

Screen Shot 2021-09-15 at 12.44.44 PM

Check out the demo generated from this text file (with help from new.css).

$ python3 silkie.py -h
Usage: silkie.py [OPTIONS]

  Static site generator with the smoothness of silk

Options:
  -v, --version          Show the version and exit.
  -h, --help             Show this message and exit.
  -i, --input PATH       Path to the input file/folder  [required]
  -s, --stylesheet TEXT  URL path to a stylesheet
Enter fullscreen mode Exit fullscreen mode

Features

  • Generate HTML file(s) from a specified text file/directory
  • Detect the title of a file if it's the first line followed by two blank lines
  • Add custom styling to static site

Getting Started

Prerequisites

  • Python >= 3.9.0
  • Pip >= 21.2.4

Installation

  1. Clone the repository
  2. Create a virtual environment

    cd silkie && python3 -m venv .
    
  3. Activate your virtual environment

    • Windows: bin\Scripts\activate.bat
    • Unix or MacOS: source bin/activate
  4. Install the dependency packages

    pip3 install -r requirements.txt
    

Usage

  1. Activate your virtual environment (only if you have not done that)
  2. Run the program

    python3 silkie.py -h
    

Contributing

Feel free to make any pull requests here. For major changes, please open an issue to discuss what you would like to change.

Happy coding!

Discussion (0)