Index

The dawn of glorp

I think Einar said that if you want to blog you should write blog posts, not write blog engine. At least sometimes people say something like that.

Einar uses WordPress.
So when Einar writes about weird DSL for writing HTML it is typically not a description of how his blog works.

Anyway it’s a thing that makes sense. So here’s a new home-made markup language for my home-made blog engine.

I’ve played around with making my own language for this a few times. I like the idea of having something where it’s so easy to implement tooling for it that, if I ever need or want to reimplement it, maybe in a different language/environment, then that won’t be a big deal. Preferably not even much of a factor in deciding if I’m going to move to a different language or something. And also simple enough so that I can write (and read) posts in that format correctly without much help from specialized tools or something.

I tend to mess up and things tend to get too complicated.

Gemtext

Gemtext

I ran into Gemtext the other day. Gemtext takes a pretty straightforward approach to some things.

You get one kind of list and you can't nest them

Which goes for most things. Like generally you can’t have <thing> within <other thing>. No quote within a list, or link within a heading, or whatever. Or, it’s very line-oriented, and you can’t like, nest lines.

It’s not too hard to build a Gemtext-parser. It’s also really easy to write Gemtext in any text editor.

Also it tends to look kind of like my plaintext-notes would look anyway. E.g. I tend to end up with stuff like paragraphs being long lines and use separate lines for links.

(Also also I like how using a full line for a link tricks me into writing more self-contained link texts (instead of stuff like the link text being “here”). Which I’m told people using screen readers sometimes appreciate.)

Glorpdown

So I decided to steal ideas from Gemtext and make something with a lot less functionality than what I have attempted previously:

A Glorpdown editor.
This post in Glorpdown.

Some basics:

Most of the things:

Regular text/paragraphs

More or less like in Gemtext. The <start> of a regular text line is the empty string. Or: If the start of a line does not match the <start> of any of the other line types, it is a regular text. Should be empty lines between paragraphs. Line breaks within paragraphs are preserved when translating to HTML and such.

Headings

Same as in Gemtext, three levels: Lines that start with #, ## or ###. E.g. I do this for the following heading:

### Blockquotes

Blockquotes

Same as in Gemtext: Lines that start with >

> Hello.

Hello.

Lists

Same as in Gemtext: Lines that start with * are list items.

* Item one
* Item two

Linky bits

Regular links are similar to the ones in Gemtext, but with a “type” argument before the path/url:

=> url https://placekitten.com/ Kittens

Kittens

Unlike in Gemtext there’s a different line type for stuff that should be included in, or viewed in context of, the document. Typically images:

<= img https://placekitten.com/200/300 A kitten!
A kitten!

(In my mind the way this makes sense is that the =>-arrow points to some thing that you can go to, while the <=-arrow is more like, the thing is moving into the current document.)

Preformatted text

Same as in Gemtext, preformatted text is turned on by a line that starts with ```. Not like in Gemtext, any non-whitespace characters directly after the ``` are considered part of the <start> and must be matched by the start of a later line to turn it off again (so you can e.g. do four backticks for the <start> if you want to have a line of preformatted text start with three backticks without that being a “turn off the preformatted text”-line). No line types or text formatting or escaping characters within preformatted text.

So:

````
code here
```
not turned off yet so things are still code
````

Becomes:

code here
```
not turned off yet so things are still code

In Gemtext you can write some stuff after the <start> of a line that turns preformatted text on and have that be “alt text.” In Glorpdown this text is instead potentially used when rendering. E.g. for marking some preformatted text as a “repl,” so that later code can turn it into a editable textare or something.

If there’s text after the <start> of a line that turns preformatted text off, then that’s used as a caption for the preformatted text.

Lines

A section of preformatted text where the text after the <start> if the line that turns it on goes like lines <w h>.

More lines-stuff, including an editor.

``` lines 40 36
t 33 5 oh no
l 20 14 19 8 11 8 10 14 3 18 4 21 10 20 9 31 12 31 15 24 17 30 21 31 19 20 25 21 25 17 20 14
l 13 10 13 11
l 17 10 17 11
l 14 14 16 14
l 23 11 29 8
```
oh no

Details

Not in gemtext. This it “toggled,” kind of like with the preformatted text. Lines that start with +++. The text after the first +++ becomes the summary. The content between a first and second +++-line is details (the stuff you see if you click to expand or something).

+++ Things
* One thing
* Another thing
* A third thing
+++
Things

Key-value pairs

Not at all in Gemtext. Mostly for metadata. Lines that start with : are key-value lines. If a line goes :<argument> <text> then <argument> is the key and <text> is the value. E.g. this post has a line that goes:

:date 2022-12-06

And then I have some blogging machinery that uses that date for displaying list of posts with their dates.

Horizontal rule/thematic change

Not in Gemtext. Lines that start with ----

----

Blah blah. That’s mostly it.