Mark is a markdown parser implemented in Go. It's fast and support extension such as Table,fence code,etc.It is safe for utf-8 input.
The parser idea comes from chjj/marked. But it isn't as complete as chjj/marked
Mark is compatible with go1.4.2 (I don't know whether compatible with go version under 1.4.2)
With go and git installed
Install pcre
sudo apt-get install libpcre++-dev // In Ubuntu
brew install pcre // In Mac OS X
Get markdown parser
go get github.com/superhx/mark
####Code
Basic usage, read a bytes then parse it to Markdown
, render Markdown
and output
//marker parse the input and return a Markdown object
mark:=mark.Mark(input)
//writer io.Writer
//render markdown to html and output to writer(without style sheet,see markdown_test to pretty)
writer := mark.NewHTMLWriter(mark)
writer.WriteTo(output)
The Markdown
is like a tree (dom tree)
If you want to operate the Markdown
instead of only simple output it. It is all free for you to modify the Markdown tree as you want. The markdown.go contain all struct
in Markdown tree.