Skip to main content

Light-wait produces the bare minimum blog content from markdown files

Project description

light-wait

GitHub release (latest by date) GitHub code size in bytes License: CC0-1.0 Keybase PGP PyPI PyPI - Wheel

light-wait is a blogging platform to produce light (as in features), minimal wait (as in fast to download) web content from markdown.

Light-wait produces the bare minimum blog content from markdown files:

  • overview and tag (category) indexes
  • RSS feed
  • configuration file to simplify customization

Here is an example screen-shot of blog content:

GIF demo

Usage

Usage: lightwait [OPTIONS] COMMAND [ARGS]...

Options:
  --debug / --no-debug
  --help    Show this message and exit.

Commands:
  export    Export markdown of content to given TARGET_DIR
  generate  Create html and rss content within given DOCROOT
  post      Create a blog post using FILE The initial lines in the FILE...
  post-all  Create a blog post for each file in SRC_DIR The initial lines...

Quick Start

  1. Install with pip

    • $ pip install lightwait

Use light-wait to generate blog content from existing markdown. Create a blog post from a single markdown file, providing optional name, description and tags, or point to a directory of markdown files and create posts from each file.

In this example, a post is created from a markdown file about opensource, and it is tagged 'software':

 $ lightwait post example/opensource.md -n opensourced -d 'How Light-wait was open-sourced' -t software

In this example, a post is created for each markdown file in the given directory mydir.

 $ lightwait post-all mydir/

Light-wait creates the static site content at the configured docrootdirectory, which by default is at /usr/local/var/www/. A python web server can be used to verify the content:

 $ cd /usr/local/var/www/
 $ python3 -m http.server

Post metadata

Each post is assigned the following metadata, either derived from the markdown file or overridden by command line arguments:

  • title: default to markdown file create date and a hash of the file name
  • description: default to first non-comment line of the markdown file
  • tags: default to general
  • date: default to markdown file create date

Additionally, a markdown file may contain this metadata as a comment at the start of the file:

[//]: # (tags:['general'])

Configuration Options

Light-wait is designed with customization in mind. When Light-wait is first run, a directory is created under the user home directory. This is called .lightwait and it will hold configuration, CSS, templates and imported markdown and metadata:

 $ cd ~/.lightwait
 $ ls
 lightwait.ini	markdown	metadata	template	www
 $

These files will only be copied if this initial set does not exist- you can freely modify them, or if you wish to start over, remove them for Light-wait to re-initialize.

The most important user-defined configurations are held in the lightwait.ini file.

This file contains the following properties, used to customize your static site:

url = http://localhost:8080/
blogTitle = title
blogSubTitle = subtitle
blogTagLine = tagLine
blogAuthor = author
blogAuthorEmail = author@example.com
blogLang = en
copyright = © name date
docroot = /usr/local/var/www/

lightwait.ini is a python INI file (see configparser), containing a default configuration section and the possibility to have multiple overriding configuration sections. Light-wait uses the lw section and inherits all defaults. You can configure the defaults for your site and override specific properties based on how you wish to deploy your static content.

An example of using an override property is to be able to test locally but deploy remotely:

[DEFAULT]
url = http://localhost:8080/

[lw]
url = http://some.domain/

Refer to the example directory for a fully configured INI.

Feel free to further customize the static content output by changing the templates (jinja2 format) or css. These can be found here:

 ~/.lightwait/template/base.index  # Common including footer
 ~/.lightwait/template/main.index  # for main index.html
 ~/.lightwait/template/tag.index   # for tag-SOMETAG.html 
 ~/.lightwait/template/post.index  # for each post
 ~/.lightwait/www/css/main.css

The static site content can be re-generated from the posts at any time using the generate command. This has an optional docroot argument, allowing you to override the configuration setting:

 $ lightwait generate

Running local web server Example

The following is an example of running lighttpd, a fast and lightweight web server, and generating web content from markdown files, using Light-wait.

To install lighttpd on MacOS using homebrew

 $ brew update 
 $ brew install lighttpd
 $ brew services start lighttpd

This installs a default configuration file /usr/local/etc/lighttpd/lighttpd.conf and a docroot at /usr/local/var/www

Then open a browser to http://localhost:8080/

Exporting your markdown

You can export all of your markdown content to a directory using the export command. This additionally will add post metadata, such as any description or tags, as markdown comments at the top of each file. Here is an example of exporting all markdown data to the directory exportdir:

 $ lightwait export ./exportdir

Tool Chain and Frameworks

The following frameworks and tools enable Light-wait:

Details are provided under the example markdown

How to Contribute

  1. Clone repo and create a new branch: $ git checkout https://github.com/mechregard/light-wait -b name_for_new_branch.
  2. Make changes and test with pytest and tox (for testing on different versions of python)
  3. Submit Pull Request with comprehensive description of changes

Donations

This is free, open-source software.

Image credit goes to: https://dauntlessfightclub.net/

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

lightwait-0.0.4.1.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

lightwait-0.0.4.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file lightwait-0.0.4.1.tar.gz.

File metadata

  • Download URL: lightwait-0.0.4.1.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.9.12 Darwin/19.6.0

File hashes

Hashes for lightwait-0.0.4.1.tar.gz
Algorithm Hash digest
SHA256 210356d40c59909094cf00234b26e7250122c70f32bdd7144ba8ed0b5ba04676
MD5 7da36acaed10e7ba5cfda88bbfbb173d
BLAKE2b-256 bb50744026731d2e81018d3e6137afcb07f5864ca11621e42b81190615bf3406

See more details on using hashes here.

File details

Details for the file lightwait-0.0.4.1-py3-none-any.whl.

File metadata

  • Download URL: lightwait-0.0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.9.12 Darwin/19.6.0

File hashes

Hashes for lightwait-0.0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e25046edab8925787f475d301ada03e1aec225f7145e1b45d27d1c4510821633
MD5 f9d3e4ded97d638f92a64640e78a5563
BLAKE2b-256 48a0ee7f907c6848bddb87a5cebb72b5a9ea198a690784c40f51f5c529501f3f

See more details on using hashes here.

Supported by

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