-- Leo's gemini proxy

-- Connecting to taoetc.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

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

-- Response ended

-- Page fetched on Mon May 6 02:33:47 2024