New blog workflow: from markdown to gemtext



I was using babille[1], a python script that build a static site from markdown files. Babille is batteries included : blog, RSS, pages, sitemap, templates...

But, but, but, I don't want to write with the markdown text format anymore and I don't want to maintain a python script. Moreover, I want a Gemini capsule :P[1]

GemText or OrgMode

I want to write my (b)log posts in the most easy and quick way. GemText[2] is some kind of very (very) light markdown. I choose that one over orgmode for its simplicity and because converting orgmode to gemtext was not as effective as I want. So, you just write and you don't bother with the formatting things because, there are none, or almost none :D.

GemText specs[2]

From markdown to gemtext

I had to convert my old blog posts to fit on the gemini server. But there was more than the format, headers had to be converted too. I wrote this little script to do the job:

# Bulk convert files with header like below:
# Title: your_title
# Date: xxxx-xx-xx
# Category: your_tag
# TO gemini gmi files date-title.gmi (required for the gemlog index)
# with header below:
# # your_title
# reformated date in the 2nd line 
# No more category
# Cleanup empty lines
# copy (do backup!!) your md files to the mdposts directory
# You need lowdown to convert your markdown files to gemtext ones
# run the script.

set -eu

# .gmi files dir
mkdir -p "${LOGDIR}"

# move to md files dir
cd "${MDFDIR}"

for f in *.md
    D=$(grep Date ${f} | awk '{ print $2 }')
    sed -i -e 's/Title:/#/' -e "s/^Date.*$/${D}/" -e 's/^Category.*$//' "${f}"
    lowdown -Tgemini -o "${D}-${}.gmi" "${f}"

for g in *.gmi
    sed -i '2d' "${g}"

mv *.gmi ../"${LOGDIR}"
rm *.md

cd -
echo done!!!

Shinobi? Atom feed?

In the beginning I was planning to move to a shinobi[3] website. It is a text-based, RSS focused blogging system. No more HTML, no more website in a classical way. But I thought that I couldn't force people to use a newsreader. This is why I have decided to convert my gemlog to html and to offer an atom feed based on the gemtext posts.

For the last one, I let you read prx's post[4], it's all that you need to build a beautiful atom feed that you can read from any web browser too.



From gemtext to html

For that I was planning to make a quick and dirty script first but as usual, prx[5] has already thought about it :P.[5]


From markdown to orgmode

For the homepage, the contact page, the about one and for my writer page, I want to use orgmode and the powerfull publish emacs engine. For those fourth pages, I did the conversion to orgmode live through emacs.


At the end, the workflow is like this:

To (b)log

Be aware that this script does the job but it can surely be improved ;).

To update the website



Commentaires / Comments ?

Envoyer un email à la liste de discussion publique / Send a mail to the public Inbox

-- Copyright © 2008–2022 Frédéric Galusik - CC BY-SA 4.0 --