Skip to content

Commit

Permalink
Merge pull request #377 from russross/v2-catch-up-readme
Browse files Browse the repository at this point in the history
Catch up README with the latest changes in code
  • Loading branch information
rtfb authored Jul 26, 2017
2 parents f86f06b + 257ccba commit f42ca5b
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,22 @@ Potential drawbacks:
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.

* Some bug fixes are trailing behind and still need to be forward-ported to v2.
See issue #348 for tracking.

Usage
-----

For basic usage, it is as simple as getting your input into a byte
slice and calling:
For the most sensible markdown processing, it is as simple as getting your input
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
feature set, use this instead:
Your input will be parsed and the output rendered with a set of most popular
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

Expand All @@ -82,17 +84,14 @@ import (
)

// ...
unsafe := blackfriday.MarkdownCommon(input)
unsafe := blackfriday.Run(input)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
```

### Custom options

If you want to customize the set of options, first get a renderer
(currently only the HTML output engine), then use it to
call the more general `Markdown` function. For examples, see the
implementations of `MarkdownBasic` and `MarkdownCommon` in
`markdown.go`.
If you want to customize the set of options, use `blackfriday.WithExtensions`,
`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.

You can also check out `blackfriday-tool` for a more complete example
of how to use it. Download and install it using:
Expand Down Expand Up @@ -214,10 +213,8 @@ implements the following extensions:
* **Strikethrough**. Use two tildes (`~~`) to mark text that
should be crossed out.
* **Hard line breaks**. With this extension enabled (it is off by
default in the `MarkdownBasic` and `MarkdownCommon` convenience
functions), newlines in the input translate into line breaks in
the output.
* **Hard line breaks**. With this extension enabled newlines in the input
translate into line breaks in the output. This extension is off by default.
* **Smart quotes**. Smartypants-style punctuation substitution is
supported, turning normal double- and single-quote marks into
Expand Down

0 comments on commit f42ca5b

Please sign in to comment.