Geminut, a Gemini -> HTML and Markdown converter in Node.js

..

   ______               _             __ 
  / ____/__  ____ ___  (_)___  __  __/ /_
 / / __/ _ \/ __ `__ \/ / __ \/ / / / __/
/ /_/ /  __/ / / / / / / / / / /_/ / /_  
\____/\___/_/ /_/ /_/_/_/ /_/\__,_/\__/  

2021-02-17

Geminut repo on Tildegit

Geminut is a simple CLI software to convert a gemlog (aka gemini capsule) to HTML or markdown. The goal is to make a simplified process for the user writing in gemini specfied syntax to be able to simultaneously post to a gemlog as well as a simple HTML blog or git repo or markdown documentation without having to hand convert.

This documentation was written in gemtext and then converted via Geminut if you are currently reading this in HTML or markdown. See the gemini README source file for the original if you're viewing this on the web or in markdown. The HTML output includes a gemini syntax-like css stylesheet.

Usage

node geminut.js input.gmi output.html

OR

node geminut.js input.gmi output.md

Screenshot

Screenshot of HTML output
Screenshot of HTML output

Method

gmi links are converted to .html and .md depending on output choice, as it's expected this is to be used to convert a blog. Links for HTML are wrapped in paragraph tags to ease readability of converted page. List items and links get an added newline break when converted to markdown to ease readability.

HTML outputs a head section and wraps output inside body, inside proper html doctype. It includes a gmi.css stylesheet by default.

Similar projects

I have not used any of these but you may wish to check these as well:

gemini-pandoc-lua-filter - A Lua filter for pandoc to output gemini text.

gemini to html - another node.js library

gmitohtml - conversion to HTML and daemon in Golang

gmi2html - conversion to HTML in Zig

Hugo to gemini - converts Hugo blogs to gemini

md2gemini - a CLI program and Python module to convert markdown to gemini by the creator of the Amfora gemini client

Notes and Resources

Gemini spec syntax

I consulted this Simple Markdown Parser with JavaScript and Regular Expressions for starter code

I learned figcaption is the proper way to caption photos in HTML

The stylesheet file was adapted from gmi-web, a public domain project