💾 Archived View for taoetc.org › converting_markdown_to_gemtext › index.gmi captured on 2023-11-14 at 08:02:21. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-19)

-=-=-=-=-=-=-

Converting Markdown to Gemtext

I received an email from Sandra Snan today, recommending two different programs to convert Markdown to Gemtext, since I've been having problems with multi-line blockquotes with md2gemini. Sandra suggested gemgen and 7off, mentioning the latter was slower but better with links.

Sandra Snan

Since I'm not really worried about performance I cloned the 7off repo, installed CHICKEN scheme, and gave it a try. It was my first time compiling a scheme program, so it took me a couple minutes to figure out that I had to run chicken-install. Once I did that 7off worked great with my blog posts, except that it doesn't support triple backticks for code blocks, only 4-space indentation.

CHICKEN scheme

While scheme looks interesting, I was really looking for a Python solution, since it's easier to integrate with my static site generator. Since I'm already using marko to parse Markdown in order to extract links I decided to write my own GeminiRenderer, and it turned out to be much simpler than I expected. My Gemini renderer is <100 LOC, and most of that is comments and whitespace.

marko

My Gemini renderer

Tags

blog

nefelibata

programming

python

Categories

STEM

About

Published on 2021-10-12 01:14:24+00:00 by Beto Dealmeida <roberto@dealmeida.net>.

Go back to the main index