A Mistune-based static site generator for Python
Project description
Blurry
Quickstart
Requirements
- Python >= 3.10
- ImageMagick
Directory structure
A Blurry project uses a simple directory structure consisting of a content
directory for Markdown site content and a templates
directory for Jinja templates used to generate HTML pages from that Markdown content.
Blurry outputs a built site into a dist
directory.
.
├──🗀 dist
├──🗀 content
│ ├──🗎 index.md
│ └──🗀 posts
└──🗀 templates
├──🗎 base.html
├──🗎 Blog.html
└──🗎 BlogPosting.html
Blurry's directory structure is used as the website's navigation structure.
Content
Blurry content files are Markdown files with front matter, which is a common pattern in other static site generators like Hugo and Jekyll.
Blurry's front matter is written in TOML.
The front matter should conform to a Schema.org Type, and the front matter will be available as template context for the Jinja template named after the schema type.
The Markdown content is converted to HTML and is added to the Jinja template context as body
.
If the Bacon Ipsum homepage were a blog post, for example, it might look something like this (some front matter omitted for brevity):
Let's look at the homepage for Table to Markdown, a site using Blurry in production:
+++
"@type" = "WebApplication"
name = "Home"
abstract = "Table to Markdown is a simple Markdown table generator that converts tables from spreadsheet applications and websites into well-formatted Markdown tables."
+++
# Easy Markdown Tables with Table to Markdown
<div class="custom-element-container">
<table-converter></table-converter>
</div>
## A beginner's guide to Markdown
In the [original Markdown spec](https://daringfireball.net/projects/markdown/), John Gruber describes Markdown as "a text-to-HTML conversion tool for web writers."
:::{info}
The Table to Markdown homepage includes a small amount of HTML in its Markdown content, including the <table-converter>
Web Component.
Web Components are a great way to sprinkle interactivity into a Markdown-based website. :::
The corresponding BlogPosting.html
file might look like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="{{ description }}">
<title>{{ headline }}</title>
{{ schema_type_tag|safe }}
{{ open_graph_tags|safe }}
</head>
<body>
{{ body|safe }}
<p>Published by: {{ author.givenName }} {{ author.familyName }}</p>
</body>
</html>
Commands
Blurry can build a static site to prepare for deployment, or it can be run as a server with live reload.
To build for production, run:
blurry build
To start the development server, run:
blurry runserver
Then visit http://127.0.0.1:8000 in your browser to see your site.
The site is rebuilt when files in the templates
and content
directories are saved.
Features
First-class Schema.org support
- Front matter in Markdown files is Schema.org structured data
- Jinja templates are named after Schema.org types (
@type
)- Blog, BlogPosting, and WebPage are supported out of the box
For more information on valid front matter, see Google Search Central's "Structured data type definitions".
Standing on the shoulders of giants
Blurry stitches together high-quality libraries:
- Mistune to convert Markdown to HTML
- Jinja for HTML templating
- LiveReload for an HTTP server with automatic browser reloading
- Typer for its CLI interface
- ImageMagick to resize and convert images
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for blurry_cli-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abc51d63ae4a5d410d6b2872479cd37e731599d97dfe87e8e6a929059d96e387 |
|
MD5 | aa41bb29fecc860aef956f57b3d74042 |
|
BLAKE2b-256 | 59e1c205f34578bfdfcc0ee1861beb3ec3fe0b22345e3a0102c552501dd88000 |