Blackfriday: a markdown processor for Go
Go to file
2011-05-28 21:33:16 -06:00
example refactored into a proper package 2011-05-28 21:17:53 -06:00
.gitignore refactored into a proper package 2011-05-28 21:17:53 -06:00
html.go refactored into a proper package 2011-05-28 21:17:53 -06:00
Makefile readme file 2011-05-28 21:33:16 -06:00
markdown.go refactored into a proper package 2011-05-28 21:17:53 -06:00
README.md readme file 2011-05-28 21:33:16 -06:00
smartypants.go readme file 2011-05-28 21:33:16 -06:00

Black Friday

This is an implementation of John Gruber's markdown in Go. It is a translation of the upskirt library written in C with a few minor changes. It retains the paranoia of the original (it is careful not to trust its input, and as such it should be safe to feed it arbitrary user-supplied inputs). It also retains the emphasis on high performance, and the source is almost as ugly as the original.

HTML output is currently supported, along with Smartpants extensions.

Installation

Assuming you have recent version of Go installed, along with git:

goinstall github.com/russross/blackfriday

will download, compile, and install the package into $GOROOT/src/pkg/github.com/russross/blackfriday.

Check out example/main.go for an example of how to use it. Run gomake in that directory to build a simple command-line markdown tool:

cd $GOROOT/src/pkg/github.com/russross/blackfriday
gomake markdown

will build the binary markdown in the example directory.

Extensions

In addition to the extensions offered by upskirt, this package implements two additional Smartypants options:

  • LaTeX-style dash parsing, where -- is translated into –
  • Generic fractions, where anything that looks like a fraction is translated into suitable HTML (instead of just a few special cases). For example, 4/5 becomes <sup>4</sup>&frasl;<sub>5</sub>

Todo

  • Code cleanup
  • Better code documentation
  • Implement a LaTeX backend