Kentaro Kuribayashi's blog

Software Engineering, Management, Books, and Daily Journal.

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.


package main

import (

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"))


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.