Skip to content

Commit 4c9bf95

Browse files
authored
v2/README: make a definitive decision on v2 import path
This change makes it clear that the v2 import path is github.com/russross/blackfriday/v2, and updates various links accordingly. See #587 (comment) for details. This change also converges the README for v1 and v2 to be consistent, as they've started to drift apart. For #587. GitHub-Pull-Request: #675
1 parent acedacf commit 4c9bf95

File tree

1 file changed

+51
-26
lines changed

1 file changed

+51
-26
lines changed

README.md

+51-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Blackfriday [![Build Status](https://travis-ci.org/russross/blackfriday.svg?branch=master)](https://travis-ci.org/russross/blackfriday)
1+
Blackfriday
2+
[![Build Status][BuildV2SVG]][BuildV2URL]
3+
[![PkgGoDev][PkgGoDevV2SVG]][PkgGoDevV2URL]
24
===========
35

46
Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
@@ -16,33 +18,31 @@ It started as a translation from C of [Sundown][3].
1618
Installation
1719
------------
1820

19-
Blackfriday is compatible with any modern Go release. With Go 1.7 and git
20-
installed:
21+
Blackfriday is compatible with modern Go releases in module mode.
22+
With Go installed:
2123

22-
go get gopkg.in/russross/blackfriday.v2
24+
go get github.com/russross/blackfriday/v2
2325

24-
will download, compile, and install the package into your `$GOPATH`
25-
directory hierarchy. Alternatively, you can achieve the same if you
26-
import it into a project:
26+
will resolve and add the package to the current development module,
27+
then build and install it. Alternatively, you can achieve the same
28+
if you import it in a package:
2729

28-
import "gopkg.in/russross/blackfriday.v2"
30+
import "github.com/russross/blackfriday/v2"
2931

3032
and `go get` without parameters.
3133

34+
Legacy GOPATH mode is unsupported.
35+
3236

3337
Versions
3438
--------
3539

3640
Currently maintained and recommended version of Blackfriday is `v2`. It's being
3741
developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
3842
documentation is available at
39-
https://godoc.org/gopkg.in/russross/blackfriday.v2.
43+
https://pkg.go.dev/github.com/russross/blackfriday/v2.
4044

41-
It is `go get`-able via via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`,
42-
but we highly recommend using package management tool like [dep][7] or
43-
[Glide][8] and make use of semantic versioning. With package management you
44-
should import `github.com/russross/blackfriday` and specify that you're using
45-
version 2.0.0.
45+
It is `go get`-able in module mode at `github.com/russross/blackfriday/v2`.
4646

4747
Version 2 offers a number of improvements over v1:
4848

@@ -62,6 +62,11 @@ Potential drawbacks:
6262
v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
6363
tracking.
6464

65+
If you are still interested in the legacy `v1`, you can import it from
66+
`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
67+
here: https://pkg.go.dev/github.com/russross/blackfriday.
68+
69+
6570
Usage
6671
-----
6772

@@ -91,7 +96,7 @@ Here's an example of simple usage of Blackfriday together with Bluemonday:
9196
```go
9297
import (
9398
"github.com/microcosm-cc/bluemonday"
94-
"github.com/russross/blackfriday"
99+
"github.com/russross/blackfriday/v2"
95100
)
96101

97102
// ...
@@ -116,7 +121,7 @@ markdown file using a standalone program. You can also browse the
116121
source directly on github if you are just looking for some example
117122
code:
118123

119-
* <http://github.com/russross/blackfriday-tool>
124+
* <https://github.com/russross/blackfriday-tool>
120125

121126
Note that if you have not already done so, installing
122127
`blackfriday-tool` will be sufficient to download and install
@@ -133,12 +138,12 @@ anchors for headings when `AutoHeadingIDs` extension is enabled. The
133138
algorithm has a specification, so that other packages can create
134139
compatible anchor names and links to those anchors.
135140

136-
The specification is located at https://godoc.org/gopkg.in/russross/blackfriday.v2#hdr-Sanitized_Anchor_Names.
141+
The specification is located at https://pkg.go.dev/github.com/russross/blackfriday/v2#hdr-Sanitized_Anchor_Names.
137142

138-
[`SanitizedAnchorName`](https://godoc.org/gopkg.in/russross/blackfriday.v2#SanitizedAnchorName) exposes this functionality, and can be used to
143+
[`SanitizedAnchorName`](https://pkg.go.dev/github.com/russross/blackfriday/v2#SanitizedAnchorName) exposes this functionality, and can be used to
139144
create compatible links to the anchor names generated by blackfriday.
140145
This algorithm is also implemented in a small standalone package at
141-
[`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
146+
[`github.com/shurcooL/sanitized_anchor_name`](https://pkg.go.dev/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
142147
that want a small package and don't need full functionality of blackfriday.
143148

144149

@@ -217,6 +222,15 @@ implements the following extensions:
217222
You can use 3 or more backticks to mark the beginning of the
218223
block, and the same number to mark the end of the block.
219224
225+
To preserve classes of fenced code blocks while using the bluemonday
226+
HTML sanitizer, use the following policy:
227+
228+
```go
229+
p := bluemonday.UGCPolicy()
230+
p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
231+
html := p.SanitizeBytes(unsafe)
232+
```
233+
220234
* **Definition lists**. A simple definition list is made of a single-line
221235
term followed by a colon and the definition for that term.
222236
@@ -268,7 +282,7 @@ Other renderers
268282
Blackfriday is structured to allow alternative rendering engines. Here
269283
are a few of note:
270284
271-
* [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown):
285+
* [github_flavored_markdown](https://pkg.go.dev/github.com/shurcooL/github_flavored_markdown):
272286
provides a GitHub Flavored Markdown renderer with fenced code block
273287
highlighting, clickable heading anchor links.
274288
@@ -279,21 +293,28 @@ are a few of note:
279293
* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
280294
but for markdown.
281295
282-
* [LaTeX output](https://github.com/Ambrevar/Blackfriday-LaTeX):
296+
* [LaTeX output](https://gitlab.com/ambrevar/blackfriday-latex):
283297
renders output as LaTeX.
284298
299+
* [bfchroma](https://github.com/Depado/bfchroma/): provides convenience
300+
integration with the [Chroma](https://github.com/alecthomas/chroma) code
301+
highlighting library. bfchroma is only compatible with v2 of Blackfriday and
302+
provides a drop-in renderer ready to use with Blackfriday, as well as
303+
options and means for further customization.
304+
285305
* [Blackfriday-Confluence](https://github.com/kentaro-m/blackfriday-confluence): provides a [Confluence Wiki Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) renderer.
286306
287307
* [Blackfriday-Slack](https://github.com/karriereat/blackfriday-slack): converts markdown to slack message style
288308
289-
Todo
309+
310+
TODO
290311
----
291312
292313
* More unit testing
293-
* Improve unicode support. It does not understand all unicode
314+
* Improve Unicode support. It does not understand all Unicode
294315
rules (about what constitutes a letter, a punctuation symbol,
295316
etc.), so it may fail to detect word boundaries correctly in
296-
some instances. It is safe on all utf-8 input.
317+
some instances. It is safe on all UTF-8 input.
297318
298319
299320
License
@@ -305,6 +326,10 @@ License
305326
[1]: https://daringfireball.net/projects/markdown/ "Markdown"
306327
[2]: https://golang.org/ "Go Language"
307328
[3]: https://github.com/vmg/sundown "Sundown"
308-
[4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func"
329+
[4]: https://pkg.go.dev/github.com/russross/blackfriday/v2#Parse "Parse func"
309330
[5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
310-
[6]: https://labix.org/gopkg.in "gopkg.in"
331+
332+
[BuildV2SVG]: https://travis-ci.org/russross/blackfriday.svg?branch=v2
333+
[BuildV2URL]: https://travis-ci.org/russross/blackfriday
334+
[PkgGoDevV2SVG]: https://pkg.go.dev/badge/github.com/russross/blackfriday/v2
335+
[PkgGoDevV2URL]: https://pkg.go.dev/github.com/russross/blackfriday/v2

0 commit comments

Comments
 (0)