A goldmark renderer for gemtext.
14f0ce27 — Thorben Kr├╝ger 1 year, 8 months ago
feature: option to mark inline URL titles with curly braces
implement image link replacers
update test for link replacers



You can also use your local clone with git send-email.

#goldmark-gemtext godocs.io builds.sr.ht status

A gemtext renderer for goldmark. You can use this library to parse commonmark markdown (with support for autolinks and strikethrough) and convert it into nice clean looking gemtext (with some options). This library does the heavy lifting for gemgen.

Several markdown extensions are supported and can be enabled as goldmark parser extensions. The following are currently supported: extension.Linkify, extension.Strikethrough, and wiki.Wiki.

You create a renderer with New(option...) and pass in options:

var src = `
# This is a heading

This is a [paragraph](https://en.wikipedia.org/wiki/Paragraph) with [some
links](https://en.wikipedia.org/wiki/Hyperlink) in it.

Next we'll have a list of some musicians I like, but as an individual list of
links. One of the neat features of goldmark-gemtext is that it recognizes when
a "paragraph" is really just a list of links and handles it as if it's a list
of links by simply converting them to the gemtext format. I wasn't able to find
any other markdown to gemtext tools that could do this so it was the
inspiration for writing this in the first place.

[Neat Beats](https://www.youtube.com/watch?v=X6kGg31G0As)\
[Sylvan Esso](https://www.sylvanesso.com/)\
[Phoebe Bridgers](https://phoebefuckingbridgers.com/)

// create markdown parser
var buf bytes.Buffer
md := goldmark.New(

// set some options
var options = []Option{WithHeadingLink(HeadingLinkAuto), WithCodeSpan(CodeSpanMarkdown)}

_ = md.Convert([]byte(src), &buf) // ignoring errors for example

There's a bunch of options. You can read them in the documentaton. If you have suggestions, issues, or anything else drop an email in the mailing list.