Git Product home page Git Product logo

static-site-generator's Introduction

Python Static Site Generator (SSG)

Uses python to generate static html files from a single txt or folder of txt files.

Prerequisites

  • Python3

Features

  • Supports stylesheets. Pass the url of the stylesheet to -s or --stylesheet (See usage).
  • Supports titles. If the first line is followed by two blank lines, it will be encased in an <h1> tag and set in <head>.
  • A blank line in the input file constitutes the end of a paragraph.
  • Markdown files (.md) is supported for bold, italics, headings, and inline code.

Example

example.txt
Custom title


This is a short paragraph.

This is a longer example
of a paragraph.

Becomes:

./dist/example.html
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Custom title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>Custom title</h1>


<p>This is a short paragraph.</p>

<p>This is a longer example
of a paragraph.</p>
</body>
</html>

Usage

  1. Passing a single text file:
ssg.py -i text.txt
  1. Passing a folder. Only txt files will be parsed:
ssg.py -i folder
  1. Passing a folder and providing a stylesheet:
ssg.py -i folder -s https://example.com/with/css.css
  1. Passing a language:
ssg.py -i folder -l pt-BR

Help

usage: ssg.py [-h] [-v] -i INPUT [-s STYLESHEET]

Static site generator

optional arguments:
  -h, --help                                Show this help message and exit
  -v, --version                             Show program's version number and exit
  -i INPUT, --input INPUT                   Pass a file or folder of files
  -s STYLESHEET, --stylesheet STYLESHEET    URL to a stylesheet
  -l LANG, --lang LANG                      Language to be set in root html tag
--help/-h

Displays a list of arguments and what they do (above).

--version/-v

Displays the program name and version.

--input/-i

Required argument. Used to provide an input folder or file. Only txt files will be parsed in folders. See usage #1 and #2.

--stylesheet/-s

Optional argument. Pass a url to a stylesheet. See usage #3.

--lang/-l

Optional argument. Pass a language to root html tag. See usage #4.

static-site-generator's People

Contributors

a-rokay avatar lmpham1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.