日記はScrapboxに移動しました。

go-hoedown: Go-bindings for Hoedown Markdown parser

Hoedown is a “standards compliant, fast, secure markdown processing library in C”. Since there has not been Go-bindings for it yet, I wrote some codes for my own practice to use cgo.

I referred to the code of Goskirt much, which is for Sundown Markdown parser from which Hoedown was forked.

Usage

package main
import (
"github.com/kentaro/go-hoedown"
"os"
)
func main () {
parser := hoedown.NewHoedown(map[string]uint{
"extensions":  hoedown.EXT_NO_INTRA_EMPHASIS | hoedown.EXT_AUTOLINK,
"renderModes": hoedown.HTML_USE_XHTML | hoedown.HTML_ESCAPE,
})
parser.Markdown(os.Stdout, []byte("# Hoedown"))
}

TODO

I haven’t been able to find yet how I can pass an anonymous function in Go to C world as a pointer to function. Hoedown provides many custom callback hook points. However, I haven’t able to utilise it because of it.

Leave a Reply

Your email address will not be published. Required fields are marked *