Skip to main content

Simple markdown based low bandwidth static site generator

Project description

PyStatisk Ascii Logo

PyStatisk

A Python port of the Kotlin Statisk project, designed to run on low power devices (RaspberryPi Zero). Converts Markdown files to simple Html with image size reduction for extreme low-bandwidth web pages.

Install

Install via PIP:

pip install Statisk

then run with:

stsk /path/to/blog/

If you encounter an error when running stsk similar to:

ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory

execute the following to fix: sudo apt-get install libopenjp2-7-dev

Setup

_template.html should be placed in root directory of the website, simple example:

<!DOCTYPE html>
<html>
    <head>
        <!-- Optional -->
        <title>{{ title }}</title>  
    </head>
    <body>
        {{ content }}
        <footer>
            <!-- Optional -->
            {{ page_size }}
        </footer>
    </body>
</html>

Blog Structure

Markdown posts need to be in a Year/Month/Day (YYYY/MM/DD) structure inside a root posts/ directory:

|- _template.html  
|- posts/  
    |- 2020/  
        |- 01/ 
            |-20/ 
                |- index.md   
                |- picture.png  
            |-15/ 
                |- index.md
    |- 2019/  
        |- 12/    
            |-24/ 
                |- index.md
                |- pictureA.png 
                |- pictureB.png 

Style Parameters

Markdown posts can set parameters to override how images are handled and to set the page background, this is done using a hidden comment at the top of the markdown file, eg:

<!--- -algorithm 5by3Bayer -threshold 100 -background #efefef -image_foreground #002233 -image_background #dedede -->

Argument Behaviour
-algorithm Sets dither algorithm (see below), eg. -algorithm stucki
-threshold Set threshold of dither algorithms in range 0 to 255, eg. -threshold 255
-image_foreground Set the foreground colour of dithered images, eg. -image_foreground #002233
-image_background Set the background colour of dithered images, eg. -image_background #ffcdcd
-background Override the page background colour, eg. -background #efefef

Dithering

Available dithering algorithms (from DitherKt):

2by2Bayer, 3by3Bayer, 4by4Bayer, 5by3Bayer, 8by8Bayer, FloydSteinberg, FalseFloydSteinberg, NewspaperHalftone, JarvisJudiceNinke, Sierra, SierraLite, TwoRowSierra, Burkes, Atkinson, Stucki, ErrorDif, Threshold, Random

there's also a greyscale filter (-algorithm greyscale), threshold is ignored.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Statisk-1.2.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

Statisk-1.2.0-py3.7.egg (16.7 kB view details)

Uploaded Egg

Statisk-1.2.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file Statisk-1.2.0.tar.gz.

File metadata

  • Download URL: Statisk-1.2.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

File hashes

Hashes for Statisk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 51239589f0cf759b3bbed4fdf26301bba064b7cdd32986957e20912f28fdd277
MD5 618fe0aa4c399de531ac1b0401c6fc58
BLAKE2b-256 67c0816b96f1f737f94b7f9f32bffac213def4725a3b3352344ce29d7ab68310

See more details on using hashes here.

File details

Details for the file Statisk-1.2.0-py3.7.egg.

File metadata

  • Download URL: Statisk-1.2.0-py3.7.egg
  • Upload date:
  • Size: 16.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

File hashes

Hashes for Statisk-1.2.0-py3.7.egg
Algorithm Hash digest
SHA256 a39bdd1a211d29a247dcee65a382038acf14c48face02412080d0b5ec410c0ca
MD5 84db74982a8902090de20a332ee3a6da
BLAKE2b-256 e06ba1b2887883aee69c08b98c4c28269f7564a56eff54b91b205d2889315018

See more details on using hashes here.

File details

Details for the file Statisk-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: Statisk-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

File hashes

Hashes for Statisk-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aeee90f87a3fdf3e7e7c12a7fad93197ce371c9c7f6d609bda8ad3b363ae61cd
MD5 4c077e5d82c2a4f7d8275916f8618e2a
BLAKE2b-256 0c026d4b113d4ce8260824caf065188f07982aaaa9f9743370566509031b7e78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page