mirror of
https://github.com/status-im/markdown.git
synced 2025-02-22 16:18:22 +00:00
Merge pull request #327 from russross/readme-update
Update README for v2
This commit is contained in:
commit
e7910a813f
51
README.md
51
README.md
@ -16,23 +16,44 @@ It started as a translation from C of [Sundown][3].
|
|||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Blackfriday is compatible with Go 1. If you are using an older
|
Blackfriday is compatible with any modern Go release. With Go 1.7 and git
|
||||||
release of Go, consider using v1.1 of blackfriday, which was based
|
installed:
|
||||||
on the last stable release of Go prior to Go 1. You can find it as a
|
|
||||||
tagged commit on github.
|
|
||||||
|
|
||||||
With Go 1 and git installed:
|
go get gopkg.in/russross/blackfriday.v2
|
||||||
|
|
||||||
go get github.com/russross/blackfriday
|
|
||||||
|
|
||||||
will download, compile, and install the package into your `$GOPATH`
|
will download, compile, and install the package into your `$GOPATH`
|
||||||
directory hierarchy. Alternatively, you can achieve the same if you
|
directory hierarchy. Alternatively, you can achieve the same if you
|
||||||
import it into a project:
|
import it into a project:
|
||||||
|
|
||||||
import "github.com/russross/blackfriday"
|
import "gopkg.in/russross/blackfriday.v2"
|
||||||
|
|
||||||
and `go get` without parameters.
|
and `go get` without parameters.
|
||||||
|
|
||||||
|
|
||||||
|
Versions
|
||||||
|
--------
|
||||||
|
|
||||||
|
Currently maintained and recommended version of Blackfriday is `v2`. It's being
|
||||||
|
developed on its own branch: https://github.com/russross/blackfriday/v2. You
|
||||||
|
should install and import it via [gopkg.in][6] at
|
||||||
|
`gopkg.in/russross/blackfriday.v2`.
|
||||||
|
|
||||||
|
Version 2 offers a number of improvements over v1:
|
||||||
|
|
||||||
|
* Cleaned up API
|
||||||
|
* A separate call to [`Parse`][4], which produces an abstract syntax tree for
|
||||||
|
the document
|
||||||
|
* Latest bug fixes
|
||||||
|
* Flexibility to easily add your own rendering extensions
|
||||||
|
|
||||||
|
Potential drawbacks:
|
||||||
|
|
||||||
|
* Our benchmarks show v2 to be slightly slower than v1. Currently in the
|
||||||
|
ballpark of around 15%.
|
||||||
|
* API breakage. If you can't afford modifying your code to adhere to the new API
|
||||||
|
and don't care too much about the new features, v2 is probably not for you.
|
||||||
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
@ -49,11 +70,10 @@ feature set, use this instead:
|
|||||||
### Sanitize untrusted content
|
### Sanitize untrusted content
|
||||||
|
|
||||||
Blackfriday itself does nothing to protect against malicious content. If you are
|
Blackfriday itself does nothing to protect against malicious content. If you are
|
||||||
dealing with user-supplied markdown, we recommend running blackfriday's output
|
dealing with user-supplied markdown, we recommend running Blackfriday's output
|
||||||
through HTML sanitizer such as
|
through HTML sanitizer such as [Bluemonday][5].
|
||||||
[Bluemonday](https://github.com/microcosm-cc/bluemonday).
|
|
||||||
|
|
||||||
Here's an example of simple usage of blackfriday together with bluemonday:
|
Here's an example of simple usage of Blackfriday together with Bluemonday:
|
||||||
|
|
||||||
``` go
|
``` go
|
||||||
import (
|
import (
|
||||||
@ -253,6 +273,9 @@ License
|
|||||||
[Blackfriday is distributed under the Simplified BSD License](LICENSE.txt)
|
[Blackfriday is distributed under the Simplified BSD License](LICENSE.txt)
|
||||||
|
|
||||||
|
|
||||||
[1]: http://daringfireball.net/projects/markdown/ "Markdown"
|
[1]: https://daringfireball.net/projects/markdown/ "Markdown"
|
||||||
[2]: http://golang.org/ "Go Language"
|
[2]: https://golang.org/ "Go Language"
|
||||||
[3]: https://github.com/vmg/sundown "Sundown"
|
[3]: https://github.com/vmg/sundown "Sundown"
|
||||||
|
[4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func"
|
||||||
|
[5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
|
||||||
|
[6]: https://labix.org/gopkg.in "gopkg.in"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user