Go API for using the pandoc document converter.
Follow th installation instructions on pandoc.org/installing.html. Then, in your project folder, run
go get github.com/alexcoder04/gopandoc
Use pandoc in your go code as follows:
package main
import (
"github.com/alexcoder04/gopandoc"
)
func main() {
// convert markdown to docx
var inBytes []byte = ...
outBytes, err := gopandoc.BytesToBytes(inBytes, "markdown", "docx")
if err != nil {
...
}
...
}
There is also a BytesToFile(input []byte, inFormat string, outFormat string, outputFile string)
function for directly writing the results into a file.