all repos — grayfriday @ de40da7ad692f7fb0c81bbc68ad49d27217c49f7

blackfriday fork with a few changes

README.md (view raw)

 1Black Friday
 2============
 3
 4This is an implementation of John Gruber's [markdown][1] in [Go][2].
 5It is a translation of the [upskirt][3] library written in C with a
 6few minor changes. It retains the paranoia of the original (it is
 7careful not to trust its input, and as such it should be safe to
 8feed it arbitrary user-supplied inputs). It also retains the
 9emphasis on high performance, and the source is almost as ugly as
10the original.
11
12HTML output is currently supported, along with Smartpants
13extensions.
14
15
16Installation
17------------
18
19Assuming you have recent version of Go installed, along with git:
20
21    goinstall github.com/russross/blackfriday
22
23will download, compile, and install the package into
24`$GOROOT/src/pkg/github.com/russross/blackfriday`.
25
26Check out `example/main.go` for an example of how to use it. Run
27`gomake` in that directory to build a simple command-line markdown
28tool:
29
30    cd $GOROOT/src/pkg/github.com/russross/blackfriday
31    gomake markdown
32
33will build the binary `markdown` in the `example` directory.
34
35
36Features
37--------
38
39All features of upskirt are supported, including:
40
41*   The Markdown v1.0.3 test suite passes with the `--tidy` option.
42    Without `--tidy`, the differences appear to be bugs/dubious
43    features in the original.
44
45*   Common extensions, including table support, fenced code blocks,
46    autolinks, strikethroughs, non-strict emphasis, etc.
47
48*   Paranoid parsing, making it safe to feed untrusted used input
49    without fear of bad things happening. There are still some
50    corner cases that are untested, but it is already more strict
51    than upskirt (Go's bounds-checking uncovered a few off-by-one
52    errors that were present in the C code).
53
54*   Good performance. I have not done rigorous benchmarking, but
55    informal testing suggests it is pretty fast. Probably not as
56    fast as upskirt, but probably faster than most others.
57
58*   Minimal dependencies. blackfriday only depends on standard
59    library packages in Go. The source code is pretty
60    self-contained, so it is easy to add to any project.
61
62
63Extensions
64----------
65
66In addition to the extensions offered by upskirt, this package
67implements two additional Smartypants options:
68
69*   LaTeX-style dash parsing, where `--` is translated into
70    `–`, and `---` is translated into `—`
71*   Generic fractions, where anything that looks like a fraction
72    is translated into suitable HTML (instead of just a few special
73    cases). For example, `4/5` becomes `<sup>4</sup>&frasl;<sub>5</sub>`
74
75
76Todo
77----
78
79*   Code cleanup
80*   Better code documentation
81*   Implement a LaTeX backend
82
83
84   [1]: http://daringfireball.net/projects/markdown/ "Markdown"
85   [2]: http://golang.org/ "Go Language"
86   [3]: http://github.com/tanoku/upskirt "Upskirt"