Catch up README with the latest changes in code

This commit is contained in:
Vytautas Šaltenis 2017-07-09 16:27:38 +03:00
parent 70c446a327
commit 257ccba98f

View File

@ -52,20 +52,22 @@ Potential drawbacks:
ballpark of around 15%. ballpark of around 15%.
* API breakage. If you can't afford modifying your code to adhere to the new API * 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. and don't care too much about the new features, v2 is probably not for you.
* Some bug fixes are trailing behind and still need to be forward-ported to v2.
See issue #348 for tracking.
Usage Usage
----- -----
For basic usage, it is as simple as getting your input into a byte For the most sensible markdown processing, it is as simple as getting your input
slice and calling: into a byte slice and calling:
output := blackfriday.MarkdownBasic(input) output := blackfriday.Run(input)
This renders it with no extensions enabled. To get a more useful Your input will be parsed and the output rendered with a set of most popular
feature set, use this instead: extensions enabled. If you want the most basic feature set, corresponding with
the bare Markdown specification, use:
output := blackfriday.MarkdownCommon(input) output := blackfriday.Run(input, blackfriday.WithNoExtensions())
### Sanitize untrusted content ### Sanitize untrusted content
@ -82,17 +84,14 @@ import (
) )
// ... // ...
unsafe := blackfriday.MarkdownCommon(input) unsafe := blackfriday.Run(input)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
``` ```
### Custom options ### Custom options
If you want to customize the set of options, first get a renderer If you want to customize the set of options, use `blackfriday.WithExtensions`,
(currently only the HTML output engine), then use it to `blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
call the more general `Markdown` function. For examples, see the
implementations of `MarkdownBasic` and `MarkdownCommon` in
`markdown.go`.
You can also check out `blackfriday-tool` for a more complete example You can also check out `blackfriday-tool` for a more complete example
of how to use it. Download and install it using: of how to use it. Download and install it using:
@ -214,10 +213,8 @@ implements the following extensions:
* **Strikethrough**. Use two tildes (`~~`) to mark text that * **Strikethrough**. Use two tildes (`~~`) to mark text that
should be crossed out. should be crossed out.
* **Hard line breaks**. With this extension enabled (it is off by * **Hard line breaks**. With this extension enabled newlines in the input
default in the `MarkdownBasic` and `MarkdownCommon` convenience translate into line breaks in the output. This extension is off by default.
functions), newlines in the input translate into line breaks in
the output.
* **Smart quotes**. Smartypants-style punctuation substitution is * **Smart quotes**. Smartypants-style punctuation substitution is
supported, turning normal double- and single-quote marks into supported, turning normal double- and single-quote marks into