kota's memex

https://sr.ht/~kota/gemgen/

Command line tool for converting markdown to gemtext.

In the future I'd like to add support for parsing HTML with one of the distiller libraries and rendering it as gemtext. This will allow me to create an html to Gemtext portal.

I wrote a markdown parser extension that reads wiki.vim style links. This allows me to export my memex as gemtext.

libraries

parser

https://github.com/yuin/goldmark

The goldmark markdown parser can read commonmark markdown and supports the extensions used on github.

https://github.com/go-shiori/go-readability

This is an HTML parser based on the firefox reader mode which strips clutter from an HTML document making it much easier and readable if you plan on converting it to markdown. I can use this and go's html package to convert arbitrary websites to gemtext or markdown.

gemtext?

It might be a bit weird, but I think I could write a goldmark or goldmark-like parser that parses gemtext. Once I have the ast tree it could output to any number of formats. This could be used to convert gemtext up to markdown (rewriting the links basically), creating html from gemtext, or rewriting the gemtext kinda like gofmt.

renderer

https://git.sr.ht/~kota/goldmark-gemtext

I wrote a renderer for goldmark that walks the AST tree and writes gemtext. This is naturally a lossy process so there are several options for different "styles" of gemtext. It's very fast, but technically could be faster. I'd also like to add a few more options for things like markdown tables and different paragraph link options. Specifically I want a mode that renders all links at the bottom of the page.

https://github.com/stephenafamo/goldmark-pdf

There's a solid PDF renderer for goldmark. I think this would only by useful if I added the gemtext parser, but it would let you write a pdf with gemtext (or any of the other input formats).

https://github.com/mdigger/goldmark-formatter

This is a markdown renderer for goldmark. I think the author used it to create a markdown auto formatter tool, but it would be useful if I add the gemtext parser for converting gemtext up to markdown.

https://github.com/robertgzr/goldmark-manpage

This is kinda silly, but I found a goldmark-manpage renderer, so in theory I could add a manpage output option for gemgen.