Lizzy.js (github) is a zero-dependency, no-build, copy-paste, open-source, client-side rendering framework for listing and rendering markdown content. E.g. a blog. It’s named after a dog: an opinionated feisty matted specimen, generously described as a terrier mix and often being interrogated with questions including but not limitted to “who’s a good girl?” and “where’s the ball?”
Zero interest in balls, btw
See https://www.highperformancewebfonts.com/ - the stuff under Reads is powered by Lizzy.js as are the articles when you click on them.
The Markdown sources are in https://www.highperformancewebfonts.com/posts/.
You point Lizzy.js to a directory on your Apache server that contains markdown files. Your Apache configuration allows directory listings. (Which is default in my Dreamhost setup, so there). Lizzy fetches (appropriately for a terrier mix) the listing HTML that Apache generates and displays the articles as a <ul>
list.
Example input:
Output:
When the user clicks an article, Lizzy fetches (ah, cheeky little pup!) the markdown file, converts it to HTML and displays it. It also puts the aricle date on top, derived from the Last-Modified
HTTP header. It also updates the URL of the article for bookmarking purposes.
Example:
.md
file. That’s it._
and it won’t be in the listing, but it will be rendered if you hit the URL directly, so you can preview your MD-foo on the live server, as it should be.package.json
-free. Just like the namesake, anything touched by a mailman is suspectCopy the contents of lizzy.js
and paste it into an HTML of your liking: a <script>
tag in an index.html
most likely
MVC (minimal viable config):
// Lizzy.js config
window.__lizzyconf = {
index: '/posts/', // where are the articles on the server
root: document.getElementById('root'), // render the app here
read: '/read/', // for bookmarking article URLs
};
When you configure Lizzy.js as above (and your domain is example.org
) it means that you keep your MD files in example.org/posts
. When the user clicks a link to, say, hello-lizzy.md
the URL of the rendered article becomes https://example.org/read/hello-lizzy
For the additional configuration/API, see the examples/config.js
folder in this repo.
If you want to render an article when people hit https://example.org/read/hello-lizzy
directly, you need to rewrite the URLs to point to the original HTML, e.g. index.html
that has Lizzy.js napping in it.
Do this in .htaccess
or similar:
RewriteEngine On
# Match all requests starting with "/read/"
RewriteRule ^read/ index.html [L]
Now this README has about as many lines as the framework
Love, 🐶