all repos — grayfriday @ f42ca5bf18fa5a63ca3a33fe9c5d0415f257eb0a

blackfriday fork with a few changes

Merge pull request #377 from russross/v2-catch-up-readme

Catch up README with the latest changes in code
Vytautas Ĺ altenis vytas@rtfb.lt
Wed, 26 Jul 2017 21:43:53 +0300
commit

f42ca5bf18fa5a63ca3a33fe9c5d0415f257eb0a

parent

f86f06b532ba7bdb7e24dc77c9bbb8c737b018dc

1 files changed, 14 insertions(+), 17 deletions(-)

jump to
M README.mdREADME.md

@@ -52,20 +52,22 @@ * 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. - +* 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

@@ -82,17 +84,14 @@ "github.com/russross/blackfriday"

) // ... -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:

@@ -214,10 +213,8 @@

* **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