🍵️

2021-07-25

I Wrote a General Gemtext Parser

https://notabug.org/tinyrabbit/gemtextparser

You can clone it and install with pip locally (I haven't published it to PyPI).

It's not a big deal, really. Despite the opinions aired in my last post gemtext is, as I mentioned, not hard to parse.

This module provides a general parser and validator. Where gmi2html reads a file line by line and determines how to translate what it gets to HTML, gemtextparser reads a file and determines what each line semantically is. What you do with those lines is up to you.

Oh, yeah, you can run it as a CLI program that validates given files as well. There's not many errors you can make when writing gemtext, but it catches two: unclosed preformatted block and empty lines (plain text and preformatted lines can be empty, of course).

-- CC0 Björn Wärmedal