Skip to content

Commit

Permalink
Document using fenced code blocks with bluemonday (#309)
Browse files Browse the repository at this point in the history
Document using fenced code blocks with bluemonday
  • Loading branch information
dunglas authored and rtfb committed Oct 3, 2016
1 parent 35eb537 commit 5f33e7b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ implements the following extensions:
You can use 3 or more backticks to mark the beginning of the
block, and the same number to mark the end of the block.

To preserve classes of fenced code blocks while using the bluemonday
HTML sanitizer, use the following policy:

``` go
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
html := p.SanitizeBytes(unsafe)
```

* **Definition lists**. A simple definition list is made of a single-line
term followed by a colon and the definition for that term.

Expand Down

0 comments on commit 5f33e7b

Please sign in to comment.