updating github.com/russross/blackfriday to v1.5.2

This commit is contained in:
Davanum Srinivas 2019-06-14 11:29:24 -04:00
parent c8051af3b9
commit caba257fc9
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
21 changed files with 536 additions and 414 deletions

27
Godeps/LICENSES generated
View File

@ -16439,33 +16439,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================ ================================================================================
================================================================================
= vendor/github.com/shurcooL/sanitized_anchor_name licensed under: =
Copyright (c) 2015 Dmitri Shuralyov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
= vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE bee2c3aa5bd0f265ffbd193eb18ca30d
================================================================================
================================================================================ ================================================================================
= vendor/github.com/sigma/go-inotify licensed under: = = vendor/github.com/sigma/go-inotify licensed under: =

3
go.mod
View File

@ -129,7 +129,6 @@ require (
github.com/robfig/cron v1.1.0 github.com/robfig/cron v1.1.0
github.com/russross/blackfriday v1.5.2 github.com/russross/blackfriday v1.5.2
github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e // indirect github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e // indirect
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db // indirect
github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
github.com/spf13/afero v0.0.0-20160816080757-b28a7effac97 github.com/spf13/afero v0.0.0-20160816080757-b28a7effac97
@ -382,7 +381,7 @@ replace (
github.com/remyoudompheng/bigfft => github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446 github.com/remyoudompheng/bigfft => github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446
github.com/robfig/cron => github.com/robfig/cron v1.1.0 github.com/robfig/cron => github.com/robfig/cron v1.1.0
github.com/rubiojr/go-vhd => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c github.com/rubiojr/go-vhd => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c
github.com/russross/blackfriday => github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 github.com/russross/blackfriday => github.com/russross/blackfriday v1.5.2
github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0
github.com/seccomp/libseccomp-golang => github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e github.com/seccomp/libseccomp-golang => github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e
github.com/shurcooL/sanitized_anchor_name => github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db github.com/shurcooL/sanitized_anchor_name => github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db

6
go.sum
View File

@ -354,14 +354,12 @@ github.com/robfig/cron v1.1.0 h1:jk4/Hud3TTdcrJgUOBgsqrZBarcxl6ADIjSC2iniwLY=
github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/robfig/cron v1.1.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c h1:ht7N4d/B7Ezf58nvMNVF3OlvDlz9pp+WHVcRNS0nink= github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c h1:ht7N4d/B7Ezf58nvMNVF3OlvDlz9pp+WHVcRNS0nink=
github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 h1:+6eORf9Bt4C3Wjt91epyu6wvLW+P6+AEODb6uKgO+4g= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e h1:HJbgNpzYMeTLPpkMwbPNTPlhNd9r4xQtqcZG6qoIGgs= github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e h1:HJbgNpzYMeTLPpkMwbPNTPlhNd9r4xQtqcZG6qoIGgs=
github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db h1:lrOUn8raSZS/V52c7elGaEyuogqSkEo/Qj2Auo2G1ik=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d h1:G1nNtZVTzcCvVKMwcG0Vispo3bhc15EbjO5uamiLikI= github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d h1:G1nNtZVTzcCvVKMwcG0Vispo3bhc15EbjO5uamiLikI=
github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d/go.mod h1:stlh9OsqBQSdwxTxX73mu41BBtRbIpZLQ7flcAoxAfo= github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d/go.mod h1:stlh9OsqBQSdwxTxX73mu41BBtRbIpZLQ7flcAoxAfo=
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=

1
vendor/BUILD vendored
View File

@ -331,7 +331,6 @@ filegroup(
"//vendor/github.com/russross/blackfriday:all-srcs", "//vendor/github.com/russross/blackfriday:all-srcs",
"//vendor/github.com/satori/go.uuid:all-srcs", "//vendor/github.com/satori/go.uuid:all-srcs",
"//vendor/github.com/seccomp/libseccomp-golang:all-srcs", "//vendor/github.com/seccomp/libseccomp-golang:all-srcs",
"//vendor/github.com/shurcooL/sanitized_anchor_name:all-srcs",
"//vendor/github.com/sigma/go-inotify:all-srcs", "//vendor/github.com/sigma/go-inotify:all-srcs",
"//vendor/github.com/sirupsen/logrus:all-srcs", "//vendor/github.com/sirupsen/logrus:all-srcs",
"//vendor/github.com/soheilhy/cmux:all-srcs", "//vendor/github.com/soheilhy/cmux:all-srcs",

View File

@ -1,18 +1,17 @@
# Travis CI (http://travis-ci.org/) is a continuous integration service for sudo: false
# open source projects. This file configures it to run unit tests for
# blackfriday.
language: go language: go
go: go:
- 1.2 - "1.9.x"
- 1.3 - "1.10.x"
- 1.4 - tip
- 1.5 matrix:
fast_finish: true
allow_failures:
- go: tip
install: install:
- go get -d -t -v ./... - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
- go build -v ./...
script: script:
- go test -v ./... - go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- go tool vet .
- go test -v -race ./...

View File

@ -4,6 +4,7 @@ go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"block.go", "block.go",
"doc.go",
"html.go", "html.go",
"inline.go", "inline.go",
"latex.go", "latex.go",
@ -13,7 +14,6 @@ go_library(
importmap = "k8s.io/kubernetes/vendor/github.com/russross/blackfriday", importmap = "k8s.io/kubernetes/vendor/github.com/russross/blackfriday",
importpath = "github.com/russross/blackfriday", importpath = "github.com/russross/blackfriday",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["//vendor/github.com/shurcooL/sanitized_anchor_name:go_default_library"],
) )
filegroup( filegroup(

View File

@ -1,4 +1,6 @@
Blackfriday [![Build Status](https://travis-ci.org/russross/blackfriday.svg?branch=master)](https://travis-ci.org/russross/blackfriday) Blackfriday
[![Build Status][BuildSVG]][BuildURL]
[![Godoc][GodocV2SVG]][GodocV2URL]
=========== ===========
Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
@ -8,7 +10,7 @@ punctuation substitutions, etc.), and it is safe for all utf-8
(unicode) input. (unicode) input.
HTML output is currently supported, along with Smartypants HTML output is currently supported, along with Smartypants
extensions. An experimental LaTeX output engine is also included. extensions.
It started as a translation from C of [Sundown][3]. It started as a translation from C of [Sundown][3].
@ -16,26 +18,71 @@ It started as a translation from C of [Sundown][3].
Installation Installation
------------ ------------
Blackfriday is compatible with Go 1. If you are using an older Blackfriday is compatible with any modern Go release. With Go and git installed:
release of Go, consider using v1.1 of blackfriday, which was based
on the last stable release of Go prior to Go 1. You can find it as a
tagged commit on github.
With Go 1 and git installed: go get -u gopkg.in/russross/blackfriday.v2
go get github.com/russross/blackfriday will download, compile, and install the package into your `$GOPATH` directory
hierarchy.
will download, compile, and install the package into your `$GOPATH`
directory hierarchy. Alternatively, you can achieve the same if you
import it into a project:
import "github.com/russross/blackfriday" Versions
--------
Currently maintained and recommended version of Blackfriday is `v2`. It's being
developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
documentation is available at
https://godoc.org/gopkg.in/russross/blackfriday.v2.
It is `go get`-able via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`,
but we highly recommend using package management tool like [dep][7] or
[Glide][8] and make use of semantic versioning. With package management you
should import `github.com/russross/blackfriday` and specify that you're using
version 2.0.0.
Version 2 offers a number of improvements over v1:
* Cleaned up API
* A separate call to [`Parse`][4], which produces an abstract syntax tree for
the document
* Latest bug fixes
* Flexibility to easily add your own rendering extensions
Potential drawbacks:
* 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.
* Several bug fixes are trailing behind and still need to be forward-ported to
v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
tracking.
If you are still interested in the legacy `v1`, you can import it from
`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
here: https://godoc.org/github.com/russross/blackfriday
### Known issue with `dep`
There is a known problem with using Blackfriday v1 _transitively_ and `dep`.
Currently `dep` prioritizes semver versions over anything else, and picks the
latest one, plus it does not apply a `[[constraint]]` specifier to transitively
pulled in packages. So if you're using something that uses Blackfriday v1, but
that something does not use `dep` yet, you will get Blackfriday v2 pulled in and
your first dependency will fail to build.
There are couple of fixes for it, documented here:
https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-constrain-a-transitive-dependencys-version
Meanwhile, `dep` team is working on a more general solution to the constraints
on transitive dependencies problem: https://github.com/golang/dep/issues/1124.
and `go get` without parameters.
Usage Usage
----- -----
### v1
For basic usage, it is as simple as getting your input into a byte For basic usage, it is as simple as getting your input into a byte
slice and calling: slice and calling:
@ -46,34 +93,57 @@ feature set, use this instead:
output := blackfriday.MarkdownCommon(input) output := blackfriday.MarkdownCommon(input)
### v2
For the most sensible markdown processing, it is as simple as getting your input
into a byte slice and calling:
```go
output := blackfriday.Run(input)
```
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:
```go
output := blackfriday.Run(input, blackfriday.WithNoExtensions())
```
### Sanitize untrusted content ### Sanitize untrusted content
Blackfriday itself does nothing to protect against malicious content. If you are Blackfriday itself does nothing to protect against malicious content. If you are
dealing with user-supplied markdown, we recommend running blackfriday's output dealing with user-supplied markdown, we recommend running Blackfriday's output
through HTML sanitizer such as through HTML sanitizer such as [Bluemonday][5].
[Bluemonday](https://github.com/microcosm-cc/bluemonday).
Here's an example of simple usage of blackfriday together with bluemonday: Here's an example of simple usage of Blackfriday together with Bluemonday:
``` go ```go
import ( import (
"github.com/microcosm-cc/bluemonday" "github.com/microcosm-cc/bluemonday"
"github.com/russross/blackfriday" "gopkg.in/russross/blackfriday.v2"
) )
// ... // ...
unsafe := blackfriday.MarkdownCommon(input) unsafe := blackfriday.Run(input)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
``` ```
### Custom options ### Custom options, v1
If you want to customize the set of options, first get a renderer If you want to customize the set of options, first get a renderer
(currently either the HTML or LaTeX output engines), then use it to (currently only the HTML output engine), then use it to
call the more general `Markdown` function. For examples, see the call the more general `Markdown` function. For examples, see the
implementations of `MarkdownBasic` and `MarkdownCommon` in implementations of `MarkdownBasic` and `MarkdownCommon` in
`markdown.go`. `markdown.go`.
### Custom options, v2
If you want to customize the set of options, use `blackfriday.WithExtensions`,
`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
### `blackfriday-tool`
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:
@ -93,6 +163,22 @@ installed in `$GOPATH/bin`. This is a statically-linked binary that
can be copied to wherever you need it without worrying about can be copied to wherever you need it without worrying about
dependencies and library versions. dependencies and library versions.
### Sanitized anchor names
Blackfriday includes an algorithm for creating sanitized anchor names
corresponding to a given input text. This algorithm is used to create
anchors for headings when `EXTENSION_AUTO_HEADER_IDS` is enabled. The
algorithm has a specification, so that other packages can create
compatible anchor names and links to those anchors.
The specification is located at https://godoc.org/github.com/russross/blackfriday#hdr-Sanitized_Anchor_Names.
[`SanitizedAnchorName`](https://godoc.org/github.com/russross/blackfriday#SanitizedAnchorName) exposes this functionality, and can be used to
create compatible links to the anchor names generated by blackfriday.
This algorithm is also implemented in a small standalone package at
[`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
that want a small package and don't need full functionality of blackfriday.
Features Features
-------- --------
@ -114,7 +200,7 @@ All features of Sundown are supported, including:
know and send me the input that does it. know and send me the input that does it.
NOTE: "safety" in this context means *runtime safety only*. In order to NOTE: "safety" in this context means *runtime safety only*. In order to
protect yourself agains JavaScript injection in untrusted content, see protect yourself against JavaScript injection in untrusted content, see
[this example](https://github.com/russross/blackfriday#sanitize-untrusted-content). [this example](https://github.com/russross/blackfriday#sanitize-untrusted-content).
* **Fast processing**. It is fast enough to render on-demand in * **Fast processing**. It is fast enough to render on-demand in
@ -169,6 +255,15 @@ implements the following extensions:
You can use 3 or more backticks to mark the beginning of the 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. 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 * **Definition lists**. A simple definition list is made of a single-line
term followed by a colon and the definition for that term. term followed by a colon and the definition for that term.
@ -224,7 +319,7 @@ are a few of note:
* [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown): * [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown):
provides a GitHub Flavored Markdown renderer with fenced code block provides a GitHub Flavored Markdown renderer with fenced code block
highlighting, clickable header anchor links. highlighting, clickable heading anchor links.
It's not customizable, and its goal is to produce HTML output It's not customizable, and its goal is to produce HTML output
equivalent to the [GitHub Markdown API endpoint](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode), equivalent to the [GitHub Markdown API endpoint](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode),
@ -233,27 +328,24 @@ are a few of note:
* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt, * [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
but for markdown. but for markdown.
* LaTeX output: renders output as LaTeX. This is currently part of the * [LaTeX output](https://bitbucket.org/ambrevar/blackfriday-latex):
main Blackfriday repository, but may be split into its own project renders output as LaTeX.
in the future. If you are interested in owning and maintaining the
LaTeX output component, please be in touch.
It renders some basic documents, but is only experimental at this * [bfchroma](https://github.com/Depado/bfchroma/): provides convenience
point. In particular, it does not do any inline escaping, so input integration with the [Chroma](https://github.com/alecthomas/chroma) code
that happens to look like LaTeX code will be passed through without highlighting library. bfchroma is only compatible with v2 of Blackfriday and
modification. provides a drop-in renderer ready to use with Blackfriday, as well as
options and means for further customization.
* [Md2Vim](https://github.com/FooSoft/md2vim): transforms markdown files into vimdoc format.
Todo TODO
---- ----
* More unit testing * More unit testing
* Improve unicode support. It does not understand all unicode * Improve Unicode support. It does not understand all Unicode
rules (about what constitutes a letter, a punctuation symbol, rules (about what constitutes a letter, a punctuation symbol,
etc.), so it may fail to detect word boundaries correctly in etc.), so it may fail to detect word boundaries correctly in
some instances. It is safe on all utf-8 input. some instances. It is safe on all UTF-8 input.
License License
@ -262,6 +354,16 @@ License
[Blackfriday is distributed under the Simplified BSD License](LICENSE.txt) [Blackfriday is distributed under the Simplified BSD License](LICENSE.txt)
[1]: http://daringfireball.net/projects/markdown/ "Markdown" [1]: https://daringfireball.net/projects/markdown/ "Markdown"
[2]: http://golang.org/ "Go Language" [2]: https://golang.org/ "Go Language"
[3]: https://github.com/vmg/sundown "Sundown" [3]: https://github.com/vmg/sundown "Sundown"
[4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func"
[5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
[6]: https://labix.org/gopkg.in "gopkg.in"
[7]: https://github.com/golang/dep/ "dep"
[8]: https://github.com/Masterminds/glide "Glide"
[BuildSVG]: https://travis-ci.org/russross/blackfriday.svg?branch=master
[BuildURL]: https://travis-ci.org/russross/blackfriday
[GodocV2SVG]: https://godoc.org/gopkg.in/russross/blackfriday.v2?status.svg
[GodocV2URL]: https://godoc.org/gopkg.in/russross/blackfriday.v2

View File

@ -15,8 +15,8 @@ package blackfriday
import ( import (
"bytes" "bytes"
"strings"
"github.com/shurcooL/sanitized_anchor_name" "unicode"
) )
// Parse block-level data. // Parse block-level data.
@ -93,7 +93,7 @@ func (p *parser) block(out *bytes.Buffer, data []byte) {
// fenced code block: // fenced code block:
// //
// ``` go // ``` go info string here
// func fact(n int) int { // func fact(n int) int {
// if n <= 1 { // if n <= 1 {
// return n // return n
@ -102,7 +102,7 @@ func (p *parser) block(out *bytes.Buffer, data []byte) {
// } // }
// ``` // ```
if p.flags&EXTENSION_FENCED_CODE != 0 { if p.flags&EXTENSION_FENCED_CODE != 0 {
if i := p.fencedCode(out, data, true); i > 0 { if i := p.fencedCodeBlock(out, data, true); i > 0 {
data = data[i:] data = data[i:]
continue continue
} }
@ -243,7 +243,7 @@ func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int {
} }
if end > i { if end > i {
if id == "" && p.flags&EXTENSION_AUTO_HEADER_IDS != 0 { if id == "" && p.flags&EXTENSION_AUTO_HEADER_IDS != 0 {
id = sanitized_anchor_name.Create(string(data[i:end])) id = SanitizedAnchorName(string(data[i:end]))
} }
work := func() bool { work := func() bool {
p.inline(out, data[i:end]) p.inline(out, data[i:end])
@ -320,6 +320,11 @@ func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int {
return size return size
} }
// check for HTML CDATA
if size := p.htmlCDATA(out, data, doRender); size > 0 {
return size
}
// no special case recognized // no special case recognized
return 0 return 0
} }
@ -397,12 +402,10 @@ func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int {
return i return i
} }
// HTML comment, lax form func (p *parser) renderHTMLBlock(out *bytes.Buffer, data []byte, start int, doRender bool) int {
func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int { // html block needs to end with a blank line
i := p.inlineHtmlComment(out, data) if i := p.isEmpty(data[start:]); i > 0 {
// needs to end with a blank line size := start + i
if j := p.isEmpty(data[i:]); j > 0 {
size := i + j
if doRender { if doRender {
// trim trailing newlines // trim trailing newlines
end := size end := size
@ -416,6 +419,35 @@ func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int
return 0 return 0
} }
// HTML comment, lax form
func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int {
i := p.inlineHTMLComment(out, data)
return p.renderHTMLBlock(out, data, i, doRender)
}
// HTML CDATA section
func (p *parser) htmlCDATA(out *bytes.Buffer, data []byte, doRender bool) int {
const cdataTag = "<![cdata["
const cdataTagLen = len(cdataTag)
if len(data) < cdataTagLen+1 {
return 0
}
if !bytes.Equal(bytes.ToLower(data[:cdataTagLen]), []byte(cdataTag)) {
return 0
}
i := cdataTagLen
// scan for an end-of-comment marker, across lines if necessary
for i < len(data) && !(data[i-2] == ']' && data[i-1] == ']' && data[i] == '>') {
i++
}
i++
// no end-of-comment marker
if i >= len(data) {
return 0
}
return p.renderHTMLBlock(out, data, i, doRender)
}
// HR, which is the only self-closing block tag considered // HR, which is the only self-closing block tag considered
func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int { func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int {
if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') { if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') {
@ -432,19 +464,7 @@ func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int {
} }
if data[i] == '>' { if data[i] == '>' {
i++ return p.renderHTMLBlock(out, data, i+1, doRender)
if j := p.isEmpty(data[i:]); j > 0 {
size := i + j
if doRender {
// trim newlines
end := size
for end > 0 && data[end-1] == '\n' {
end--
}
p.r.BlockHtml(out, data[:end])
}
return size
}
} }
return 0 return 0
@ -495,7 +515,7 @@ func (p *parser) htmlFindEnd(tag string, data []byte) int {
return i + skip return i + skip
} }
func (p *parser) isEmpty(data []byte) int { func (*parser) isEmpty(data []byte) int {
// it is okay to call isEmpty on an empty buffer // it is okay to call isEmpty on an empty buffer
if len(data) == 0 { if len(data) == 0 {
return 0 return 0
@ -510,7 +530,7 @@ func (p *parser) isEmpty(data []byte) int {
return i + 1 return i + 1
} }
func (p *parser) isHRule(data []byte) bool { func (*parser) isHRule(data []byte) bool {
i := 0 i := 0
// skip up to three spaces // skip up to three spaces
@ -539,21 +559,24 @@ func (p *parser) isHRule(data []byte) bool {
return n >= 3 return n >= 3
} }
func (p *parser) isFencedCode(data []byte, syntax **string, oldmarker string) (skip int, marker string) { // isFenceLine checks if there's a fence line (e.g., ``` or ``` go) at the beginning of data,
// and returns the end index if so, or 0 otherwise. It also returns the marker found.
// If syntax is not nil, it gets set to the syntax specified in the fence line.
// A final newline is mandatory to recognize the fence line, unless newlineOptional is true.
func isFenceLine(data []byte, info *string, oldmarker string, newlineOptional bool) (end int, marker string) {
i, size := 0, 0 i, size := 0, 0
skip = 0
// skip up to three spaces // skip up to three spaces
for i < len(data) && i < 3 && data[i] == ' ' { for i < len(data) && i < 3 && data[i] == ' ' {
i++ i++
} }
if i >= len(data) {
return
}
// check for the marker characters: ~ or ` // check for the marker characters: ~ or `
if i >= len(data) {
return 0, ""
}
if data[i] != '~' && data[i] != '`' { if data[i] != '~' && data[i] != '`' {
return return 0, ""
} }
c := data[i] c := data[i]
@ -564,79 +587,84 @@ func (p *parser) isFencedCode(data []byte, syntax **string, oldmarker string) (s
i++ i++
} }
if i >= len(data) {
return
}
// the marker char must occur at least 3 times // the marker char must occur at least 3 times
if size < 3 { if size < 3 {
return return 0, ""
} }
marker = string(data[i-size : i]) marker = string(data[i-size : i])
// if this is the end marker, it must match the beginning marker // if this is the end marker, it must match the beginning marker
if oldmarker != "" && marker != oldmarker { if oldmarker != "" && marker != oldmarker {
return return 0, ""
} }
if syntax != nil { // TODO(shurcooL): It's probably a good idea to simplify the 2 code paths here
syn := 0 // into one, always get the info string, and discard it if the caller doesn't care.
if info != nil {
infoLength := 0
i = skipChar(data, i, ' ') i = skipChar(data, i, ' ')
if i >= len(data) { if i >= len(data) {
return if newlineOptional && i == len(data) {
return i, marker
}
return 0, ""
} }
syntaxStart := i infoStart := i
if data[i] == '{' { if data[i] == '{' {
i++ i++
syntaxStart++ infoStart++
for i < len(data) && data[i] != '}' && data[i] != '\n' { for i < len(data) && data[i] != '}' && data[i] != '\n' {
syn++ infoLength++
i++ i++
} }
if i >= len(data) || data[i] != '}' { if i >= len(data) || data[i] != '}' {
return return 0, ""
} }
// strip all whitespace at the beginning and the end // strip all whitespace at the beginning and the end
// of the {} block // of the {} block
for syn > 0 && isspace(data[syntaxStart]) { for infoLength > 0 && isspace(data[infoStart]) {
syntaxStart++ infoStart++
syn-- infoLength--
} }
for syn > 0 && isspace(data[syntaxStart+syn-1]) { for infoLength > 0 && isspace(data[infoStart+infoLength-1]) {
syn-- infoLength--
} }
i++ i++
} else { } else {
for i < len(data) && !isspace(data[i]) { for i < len(data) && !isverticalspace(data[i]) {
syn++ infoLength++
i++ i++
} }
} }
language := string(data[syntaxStart : syntaxStart+syn]) *info = strings.TrimSpace(string(data[infoStart : infoStart+infoLength]))
*syntax = &language
} }
i = skipChar(data, i, ' ') i = skipChar(data, i, ' ')
if i >= len(data) || data[i] != '\n' { if i >= len(data) || data[i] != '\n' {
return if newlineOptional && i == len(data) {
return i, marker
}
return 0, ""
} }
skip = i + 1 return i + 1, marker // Take newline into account.
return
} }
func (p *parser) fencedCode(out *bytes.Buffer, data []byte, doRender bool) int { // fencedCodeBlock returns the end index if data contains a fenced code block at the beginning,
var lang *string // or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects.
beg, marker := p.isFencedCode(data, &lang, "") // If doRender is true, a final newline is mandatory to recognize the fenced code block.
func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int {
var infoString string
beg, marker := isFenceLine(data, &infoString, "", false)
if beg == 0 || beg >= len(data) { if beg == 0 || beg >= len(data) {
return 0 return 0
} }
@ -647,7 +675,8 @@ func (p *parser) fencedCode(out *bytes.Buffer, data []byte, doRender bool) int {
// safe to assume beg < len(data) // safe to assume beg < len(data)
// check for the end of the code block // check for the end of the code block
fenceEnd, _ := p.isFencedCode(data[beg:], nil, marker) newlineOptional := !doRender
fenceEnd, _ := isFenceLine(data[beg:], nil, marker, newlineOptional)
if fenceEnd != 0 { if fenceEnd != 0 {
beg += fenceEnd beg += fenceEnd
break break
@ -668,13 +697,8 @@ func (p *parser) fencedCode(out *bytes.Buffer, data []byte, doRender bool) int {
beg = end beg = end
} }
syntax := ""
if lang != nil {
syntax = *lang
}
if doRender { if doRender {
p.r.BlockCode(out, work.Bytes(), syntax) p.r.BlockCode(out, work.Bytes(), infoString)
} }
return beg return beg
@ -914,7 +938,7 @@ func (p *parser) quote(out *bytes.Buffer, data []byte) int {
// irregardless of any contents inside it // irregardless of any contents inside it
for data[end] != '\n' { for data[end] != '\n' {
if p.flags&EXTENSION_FENCED_CODE != 0 { if p.flags&EXTENSION_FENCED_CODE != 0 {
if i := p.fencedCode(out, data[end:], false); i > 0 { if i := p.fencedCodeBlock(out, data[end:], false); i > 0 {
// -1 to compensate for the extra end++ after the loop: // -1 to compensate for the extra end++ after the loop:
end += i - 1 end += i - 1
break break
@ -1119,6 +1143,7 @@ func (p *parser) listItem(out *bytes.Buffer, data []byte, flags *int) int {
// process the following lines // process the following lines
containsBlankLine := false containsBlankLine := false
sublist := 0 sublist := 0
codeBlockMarker := ""
gatherlines: gatherlines:
for line < len(data) { for line < len(data) {
@ -1133,6 +1158,7 @@ gatherlines:
// and move on to the next line // and move on to the next line
if p.isEmpty(data[line:i]) > 0 { if p.isEmpty(data[line:i]) > 0 {
containsBlankLine = true containsBlankLine = true
raw.Write(data[line:i])
line = i line = i
continue continue
} }
@ -1145,6 +1171,28 @@ gatherlines:
chunk := data[line+indent : i] chunk := data[line+indent : i]
if p.flags&EXTENSION_FENCED_CODE != 0 {
// determine if in or out of codeblock
// if in codeblock, ignore normal list processing
_, marker := isFenceLine(chunk, nil, codeBlockMarker, false)
if marker != "" {
if codeBlockMarker == "" {
// start of codeblock
codeBlockMarker = marker
} else {
// end of codeblock.
*flags |= LIST_ITEM_CONTAINS_BLOCK
codeBlockMarker = ""
}
}
// we are in a codeblock, write line, and continue
if codeBlockMarker != "" || marker != "" {
raw.Write(data[line+indent : i])
line = i
continue gatherlines
}
}
// evaluate how this line fits in // evaluate how this line fits in
switch { switch {
// is this a nested list item? // is this a nested list item?
@ -1153,6 +1201,14 @@ gatherlines:
p.dliPrefix(chunk) > 0: p.dliPrefix(chunk) > 0:
if containsBlankLine { if containsBlankLine {
// end the list if the type changed after a blank line
if indent <= itemIndent &&
((*flags&LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) ||
(*flags&LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0)) {
*flags |= LIST_ITEM_END_OF_LIST
break gatherlines
}
*flags |= LIST_ITEM_CONTAINS_BLOCK *flags |= LIST_ITEM_CONTAINS_BLOCK
} }
@ -1200,17 +1256,10 @@ gatherlines:
// a blank line means this should be parsed as a block // a blank line means this should be parsed as a block
case containsBlankLine: case containsBlankLine:
raw.WriteByte('\n')
*flags |= LIST_ITEM_CONTAINS_BLOCK *flags |= LIST_ITEM_CONTAINS_BLOCK
} }
// if this line was preceeded by one or more blanks, containsBlankLine = false
// re-introduce the blank into the buffer
if containsBlankLine {
containsBlankLine = false
raw.WriteByte('\n')
}
// add the line into the working buffer without prefix // add the line into the working buffer without prefix
raw.Write(data[line+indent : i]) raw.Write(data[line+indent : i])
@ -1218,6 +1267,12 @@ gatherlines:
line = i line = i
} }
// If reached end of data, the Renderer.ListItem call we're going to make below
// is definitely the last in the list.
if line >= len(data) {
*flags |= LIST_ITEM_END_OF_LIST
}
rawBytes := raw.Bytes() rawBytes := raw.Bytes()
// render the contents of the list item // render the contents of the list item
@ -1332,7 +1387,7 @@ func (p *parser) paragraph(out *bytes.Buffer, data []byte) int {
id := "" id := ""
if p.flags&EXTENSION_AUTO_HEADER_IDS != 0 { if p.flags&EXTENSION_AUTO_HEADER_IDS != 0 {
id = sanitized_anchor_name.Create(string(data[prev:eol])) id = SanitizedAnchorName(string(data[prev:eol]))
} }
p.r.Header(out, work, level, id) p.r.Header(out, work, level, id)
@ -1362,7 +1417,7 @@ func (p *parser) paragraph(out *bytes.Buffer, data []byte) int {
// if there's a fenced code block, paragraph is over // if there's a fenced code block, paragraph is over
if p.flags&EXTENSION_FENCED_CODE != 0 { if p.flags&EXTENSION_FENCED_CODE != 0 {
if p.fencedCode(out, current, false) > 0 { if p.fencedCodeBlock(out, current, false) > 0 {
p.renderParagraph(out, data[:i]) p.renderParagraph(out, data[:i])
return i return i
} }
@ -1396,3 +1451,24 @@ func (p *parser) paragraph(out *bytes.Buffer, data []byte) int {
p.renderParagraph(out, data[:i]) p.renderParagraph(out, data[:i])
return i return i
} }
// SanitizedAnchorName returns a sanitized anchor name for the given text.
//
// It implements the algorithm specified in the package comment.
func SanitizedAnchorName(text string) string {
var anchorName []rune
futureDash := false
for _, r := range text {
switch {
case unicode.IsLetter(r) || unicode.IsNumber(r):
if futureDash && len(anchorName) > 0 {
anchorName = append(anchorName, '-')
}
futureDash = false
anchorName = append(anchorName, unicode.ToLower(r))
default:
futureDash = true
}
}
return string(anchorName)
}

32
vendor/github.com/russross/blackfriday/doc.go generated vendored Normal file
View File

@ -0,0 +1,32 @@
// Package blackfriday is a Markdown processor.
//
// It translates plain text with simple formatting rules into HTML or LaTeX.
//
// Sanitized Anchor Names
//
// Blackfriday includes an algorithm for creating sanitized anchor names
// corresponding to a given input text. This algorithm is used to create
// anchors for headings when EXTENSION_AUTO_HEADER_IDS is enabled. The
// algorithm is specified below, so that other packages can create
// compatible anchor names and links to those anchors.
//
// The algorithm iterates over the input text, interpreted as UTF-8,
// one Unicode code point (rune) at a time. All runes that are letters (category L)
// or numbers (category N) are considered valid characters. They are mapped to
// lower case, and included in the output. All other runes are considered
// invalid characters. Invalid characters that preceed the first valid character,
// as well as invalid character that follow the last valid character
// are dropped completely. All other sequences of invalid characters
// between two valid characters are replaced with a single dash character '-'.
//
// SanitizedAnchorName exposes this functionality, and can be used to
// create compatible links to the anchor names generated by blackfriday.
// This algorithm is also implemented in a small standalone package at
// github.com/shurcooL/sanitized_anchor_name. It can be useful for clients
// that want a small package and don't need full functionality of blackfriday.
package blackfriday
// NOTE: Keep Sanitized Anchor Name algorithm in sync with package
// github.com/shurcooL/sanitized_anchor_name.
// Otherwise, users of sanitized_anchor_name will get anchor names
// that are incompatible with those generated by blackfriday.

1
vendor/github.com/russross/blackfriday/go.mod generated vendored Normal file
View File

@ -0,0 +1 @@
module github.com/russross/blackfriday

View File

@ -42,6 +42,7 @@ const (
HTML_SMARTYPANTS_DASHES // enable smart dashes (with HTML_USE_SMARTYPANTS) HTML_SMARTYPANTS_DASHES // enable smart dashes (with HTML_USE_SMARTYPANTS)
HTML_SMARTYPANTS_LATEX_DASHES // enable LaTeX-style dashes (with HTML_USE_SMARTYPANTS and HTML_SMARTYPANTS_DASHES) HTML_SMARTYPANTS_LATEX_DASHES // enable LaTeX-style dashes (with HTML_USE_SMARTYPANTS and HTML_SMARTYPANTS_DASHES)
HTML_SMARTYPANTS_ANGLED_QUOTES // enable angled double quotes (with HTML_USE_SMARTYPANTS) for double quotes rendering HTML_SMARTYPANTS_ANGLED_QUOTES // enable angled double quotes (with HTML_USE_SMARTYPANTS) for double quotes rendering
HTML_SMARTYPANTS_QUOTES_NBSP // enable "French guillemets" (with HTML_USE_SMARTYPANTS)
HTML_FOOTNOTE_RETURN_LINKS // generate a link at the end of a footnote to return to the source HTML_FOOTNOTE_RETURN_LINKS // generate a link at the end of a footnote to return to the source
) )
@ -254,33 +255,21 @@ func (options *Html) HRule(out *bytes.Buffer) {
out.WriteByte('\n') out.WriteByte('\n')
} }
func (options *Html) BlockCode(out *bytes.Buffer, text []byte, lang string) { func (options *Html) BlockCode(out *bytes.Buffer, text []byte, info string) {
doubleSpace(out) doubleSpace(out)
// parse out the language names/classes endOfLang := strings.IndexAny(info, "\t ")
count := 0 if endOfLang < 0 {
for _, elt := range strings.Fields(lang) { endOfLang = len(info)
if elt[0] == '.' {
elt = elt[1:]
}
if len(elt) == 0 {
continue
}
if count == 0 {
out.WriteString("<pre><code class=\"language-")
} else {
out.WriteByte(' ')
}
attrEscape(out, []byte(elt))
count++
} }
lang := info[:endOfLang]
if count == 0 { if len(lang) == 0 || lang == "." {
out.WriteString("<pre><code>") out.WriteString("<pre><code>")
} else { } else {
out.WriteString("<pre><code class=\"language-")
attrEscape(out, []byte(lang))
out.WriteString("\">") out.WriteString("\">")
} }
attrEscape(out, text) attrEscape(out, text)
out.WriteString("</code></pre>\n") out.WriteString("</code></pre>\n")
} }
@ -619,7 +608,7 @@ func (options *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
out.WriteString(`fnref:`) out.WriteString(`fnref:`)
out.WriteString(options.parameters.FootnoteAnchorPrefix) out.WriteString(options.parameters.FootnoteAnchorPrefix)
out.Write(slug) out.Write(slug)
out.WriteString(`"><a rel="footnote" href="#`) out.WriteString(`"><a href="#`)
out.WriteString(`fn:`) out.WriteString(`fn:`)
out.WriteString(options.parameters.FootnoteAnchorPrefix) out.WriteString(options.parameters.FootnoteAnchorPrefix)
out.Write(slug) out.Write(slug)

View File

@ -170,6 +170,10 @@ func lineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) int {
precededByBackslash := offset >= 1 && data[offset-1] == '\\' // see http://spec.commonmark.org/0.18/#example-527 precededByBackslash := offset >= 1 && data[offset-1] == '\\' // see http://spec.commonmark.org/0.18/#example-527
precededByBackslash = precededByBackslash && p.flags&EXTENSION_BACKSLASH_LINE_BREAK != 0 precededByBackslash = precededByBackslash && p.flags&EXTENSION_BACKSLASH_LINE_BREAK != 0
if p.flags&EXTENSION_JOIN_LINES != 0 {
return 1
}
// should there be a hard line break here? // should there be a hard line break here?
if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && !precededByTwoSpaces && !precededByBackslash { if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && !precededByTwoSpaces && !precededByBackslash {
return 0 return 0
@ -240,6 +244,8 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
i++ i++
} }
brace := 0
// look for the matching closing bracket // look for the matching closing bracket
for level := 1; level > 0 && i < len(data); i++ { for level := 1; level > 0 && i < len(data); i++ {
switch { switch {
@ -273,8 +279,8 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
i++ i++
} }
// inline style link
switch { switch {
// inline style link
case i < len(data) && data[i] == '(': case i < len(data) && data[i] == '(':
// skip initial whitespace // skip initial whitespace
i++ i++
@ -285,14 +291,27 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
linkB := i linkB := i
// look for link end: ' " ) // look for link end: ' " ), check for new opening braces and take this
// into account, this may lead for overshooting and probably will require
// some fine-tuning.
findlinkend: findlinkend:
for i < len(data) { for i < len(data) {
switch { switch {
case data[i] == '\\': case data[i] == '\\':
i += 2 i += 2
case data[i] == ')' || data[i] == '\'' || data[i] == '"': case data[i] == '(':
brace++
i++
case data[i] == ')':
if brace <= 0 {
break findlinkend
}
brace--
i++
case data[i] == '\'' || data[i] == '"':
break findlinkend break findlinkend
default: default:
@ -469,6 +488,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
} }
p.notes = append(p.notes, ref) p.notes = append(p.notes, ref)
p.notesRecord[string(ref.link)] = struct{}{}
link = ref.link link = ref.link
title = ref.title title = ref.title
@ -479,9 +499,10 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
return 0 return 0
} }
if t == linkDeferredFootnote { if t == linkDeferredFootnote && !p.isFootnote(lr) {
lr.noteId = len(p.notes) + 1 lr.noteId = len(p.notes) + 1
p.notes = append(p.notes, lr) p.notes = append(p.notes, lr)
p.notesRecord[string(lr.link)] = struct{}{}
} }
// keep link and title from reference // keep link and title from reference
@ -560,7 +581,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
return i return i
} }
func (p *parser) inlineHtmlComment(out *bytes.Buffer, data []byte) int { func (p *parser) inlineHTMLComment(out *bytes.Buffer, data []byte) int {
if len(data) < 5 { if len(data) < 5 {
return 0 return 0
} }
@ -584,7 +605,7 @@ func leftAngle(p *parser, out *bytes.Buffer, data []byte, offset int) int {
data = data[offset:] data = data[offset:]
altype := LINK_TYPE_NOT_AUTOLINK altype := LINK_TYPE_NOT_AUTOLINK
end := tagLength(data, &altype) end := tagLength(data, &altype)
if size := p.inlineHtmlComment(out, data); size > 0 { if size := p.inlineHTMLComment(out, data); size > 0 {
end = size end = size
} }
if end > 2 { if end > 2 {
@ -923,7 +944,7 @@ func isMailtoAutoLink(data []byte) int {
nb++ nb++
case '-', '.', '_': case '-', '.', '_':
break // Do nothing.
case '>': case '>':
if nb == 1 { if nb == 1 {

View File

@ -17,6 +17,7 @@ package blackfriday
import ( import (
"bytes" "bytes"
"strings"
) )
// Latex is a type that implements the Renderer interface for LaTeX output. // Latex is a type that implements the Renderer interface for LaTeX output.
@ -39,16 +40,17 @@ func (options *Latex) GetFlags() int {
} }
// render code chunks using verbatim, or listings if we have a language // render code chunks using verbatim, or listings if we have a language
func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) { func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, info string) {
if lang == "" { if info == "" {
out.WriteString("\n\\begin{verbatim}\n") out.WriteString("\n\\begin{verbatim}\n")
} else { } else {
lang := strings.Fields(info)[0]
out.WriteString("\n\\begin{lstlisting}[language=") out.WriteString("\n\\begin{lstlisting}[language=")
out.WriteString(lang) out.WriteString(lang)
out.WriteString("]\n") out.WriteString("]\n")
} }
out.Write(text) out.Write(text)
if lang == "" { if info == "" {
out.WriteString("\n\\end{verbatim}\n") out.WriteString("\n\\end{verbatim}\n")
} else { } else {
out.WriteString("\n\\end{lstlisting}\n") out.WriteString("\n\\end{lstlisting}\n")

View File

@ -13,9 +13,6 @@
// //
// //
// Blackfriday markdown processor.
//
// Translates plain text with simple formatting rules into HTML or LaTeX.
package blackfriday package blackfriday
import ( import (
@ -25,7 +22,7 @@ import (
"unicode/utf8" "unicode/utf8"
) )
const VERSION = "1.4" const VERSION = "1.5"
// These are the supported markdown parsing extensions. // These are the supported markdown parsing extensions.
// OR these values together to select multiple extensions. // OR these values together to select multiple extensions.
@ -46,6 +43,7 @@ const (
EXTENSION_AUTO_HEADER_IDS // Create the header ID from the text EXTENSION_AUTO_HEADER_IDS // Create the header ID from the text
EXTENSION_BACKSLASH_LINE_BREAK // translate trailing backslashes into line breaks EXTENSION_BACKSLASH_LINE_BREAK // translate trailing backslashes into line breaks
EXTENSION_DEFINITION_LISTS // render definition lists EXTENSION_DEFINITION_LISTS // render definition lists
EXTENSION_JOIN_LINES // delete newline and join lines
commonHtmlFlags = 0 | commonHtmlFlags = 0 |
HTML_USE_XHTML | HTML_USE_XHTML |
@ -105,46 +103,46 @@ const (
// blockTags is a set of tags that are recognized as HTML block tags. // blockTags is a set of tags that are recognized as HTML block tags.
// Any of these can be included in markdown text without special escaping. // Any of these can be included in markdown text without special escaping.
var blockTags = map[string]struct{}{ var blockTags = map[string]struct{}{
"blockquote": struct{}{}, "blockquote": {},
"del": struct{}{}, "del": {},
"div": struct{}{}, "div": {},
"dl": struct{}{}, "dl": {},
"fieldset": struct{}{}, "fieldset": {},
"form": struct{}{}, "form": {},
"h1": struct{}{}, "h1": {},
"h2": struct{}{}, "h2": {},
"h3": struct{}{}, "h3": {},
"h4": struct{}{}, "h4": {},
"h5": struct{}{}, "h5": {},
"h6": struct{}{}, "h6": {},
"iframe": struct{}{}, "iframe": {},
"ins": struct{}{}, "ins": {},
"math": struct{}{}, "math": {},
"noscript": struct{}{}, "noscript": {},
"ol": struct{}{}, "ol": {},
"pre": struct{}{}, "pre": {},
"p": struct{}{}, "p": {},
"script": struct{}{}, "script": {},
"style": struct{}{}, "style": {},
"table": struct{}{}, "table": {},
"ul": struct{}{}, "ul": {},
// HTML5 // HTML5
"address": struct{}{}, "address": {},
"article": struct{}{}, "article": {},
"aside": struct{}{}, "aside": {},
"canvas": struct{}{}, "canvas": {},
"figcaption": struct{}{}, "figcaption": {},
"figure": struct{}{}, "figure": {},
"footer": struct{}{}, "footer": {},
"header": struct{}{}, "header": {},
"hgroup": struct{}{}, "hgroup": {},
"main": struct{}{}, "main": {},
"nav": struct{}{}, "nav": {},
"output": struct{}{}, "output": {},
"progress": struct{}{}, "progress": {},
"section": struct{}{}, "section": {},
"video": struct{}{}, "video": {},
} }
// Renderer is the rendering interface. // Renderer is the rendering interface.
@ -161,7 +159,7 @@ var blockTags = map[string]struct{}{
// Currently Html and Latex implementations are provided // Currently Html and Latex implementations are provided
type Renderer interface { type Renderer interface {
// block-level callbacks // block-level callbacks
BlockCode(out *bytes.Buffer, text []byte, lang string) BlockCode(out *bytes.Buffer, text []byte, infoString string)
BlockQuote(out *bytes.Buffer, text []byte) BlockQuote(out *bytes.Buffer, text []byte)
BlockHtml(out *bytes.Buffer, text []byte) BlockHtml(out *bytes.Buffer, text []byte)
Header(out *bytes.Buffer, text func() bool, level int, id string) Header(out *bytes.Buffer, text func() bool, level int, id string)
@ -220,7 +218,8 @@ type parser struct {
// Footnotes need to be ordered as well as available to quickly check for // Footnotes need to be ordered as well as available to quickly check for
// presence. If a ref is also a footnote, it's stored both in refs and here // presence. If a ref is also a footnote, it's stored both in refs and here
// in notes. Slice is nil if footnotes not enabled. // in notes. Slice is nil if footnotes not enabled.
notes []*reference notes []*reference
notesRecord map[string]struct{}
} }
func (p *parser) getRef(refid string) (ref *reference, found bool) { func (p *parser) getRef(refid string) (ref *reference, found bool) {
@ -243,6 +242,11 @@ func (p *parser) getRef(refid string) (ref *reference, found bool) {
return ref, found return ref, found
} }
func (p *parser) isFootnote(ref *reference) bool {
_, ok := p.notesRecord[string(ref.link)]
return ok
}
// //
// //
// Public interface // Public interface
@ -378,6 +382,7 @@ func MarkdownOptions(input []byte, renderer Renderer, opts Options) []byte {
if extensions&EXTENSION_FOOTNOTES != 0 { if extensions&EXTENSION_FOOTNOTES != 0 {
p.notes = make([]*reference, 0) p.notes = make([]*reference, 0)
p.notesRecord = make(map[string]struct{})
} }
first := firstPass(p, input) first := firstPass(p, input)
@ -386,9 +391,9 @@ func MarkdownOptions(input []byte, renderer Renderer, opts Options) []byte {
} }
// first pass: // first pass:
// - extract references
// - expand tabs
// - normalize newlines // - normalize newlines
// - extract references (outside of fenced code blocks)
// - expand tabs (outside of fenced code blocks)
// - copy everything else // - copy everything else
func firstPass(p *parser, input []byte) []byte { func firstPass(p *parser, input []byte) []byte {
var out bytes.Buffer var out bytes.Buffer
@ -396,46 +401,46 @@ func firstPass(p *parser, input []byte) []byte {
if p.flags&EXTENSION_TAB_SIZE_EIGHT != 0 { if p.flags&EXTENSION_TAB_SIZE_EIGHT != 0 {
tabSize = TAB_SIZE_EIGHT tabSize = TAB_SIZE_EIGHT
} }
beg, end := 0, 0 beg := 0
lastFencedCodeBlockEnd := 0 lastFencedCodeBlockEnd := 0
for beg < len(input) { // iterate over lines for beg < len(input) {
if end = isReference(p, input[beg:], tabSize); end > 0 { // Find end of this line, then process the line.
beg += end end := beg
} else { // skip to the next line for end < len(input) && input[end] != '\n' && input[end] != '\r' {
end = beg end++
for end < len(input) && input[end] != '\n' && input[end] != '\r' {
end++
}
if p.flags&EXTENSION_FENCED_CODE != 0 {
// track fenced code block boundaries to suppress tab expansion
// inside them:
if beg >= lastFencedCodeBlockEnd {
if i := p.fencedCode(&out, input[beg:], false); i > 0 {
lastFencedCodeBlockEnd = beg + i
}
}
}
// add the line body if present
if end > beg {
if end < lastFencedCodeBlockEnd { // Do not expand tabs while inside fenced code blocks.
out.Write(input[beg:end])
} else {
expandTabs(&out, input[beg:end], tabSize)
}
}
out.WriteByte('\n')
if end < len(input) && input[end] == '\r' {
end++
}
if end < len(input) && input[end] == '\n' {
end++
}
beg = end
} }
if p.flags&EXTENSION_FENCED_CODE != 0 {
// track fenced code block boundaries to suppress tab expansion
// and reference extraction inside them:
if beg >= lastFencedCodeBlockEnd {
if i := p.fencedCodeBlock(&out, input[beg:], false); i > 0 {
lastFencedCodeBlockEnd = beg + i
}
}
}
// add the line body if present
if end > beg {
if end < lastFencedCodeBlockEnd { // Do not expand tabs while inside fenced code blocks.
out.Write(input[beg:end])
} else if refEnd := isReference(p, input[beg:], tabSize); refEnd > 0 {
beg += refEnd
continue
} else {
expandTabs(&out, input[beg:end], tabSize)
}
}
if end < len(input) && input[end] == '\r' {
end++
}
if end < len(input) && input[end] == '\n' {
end++
}
out.WriteByte('\n')
beg = end
} }
// empty input? // empty input?
@ -635,12 +640,12 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse
i++ i++
} }
linkOffset = i linkOffset = i
for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' {
i++
}
if i == len(data) { if i == len(data) {
return return
} }
for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' {
i++
}
linkEnd = i linkEnd = i
if data[linkOffset] == '<' && data[linkEnd-1] == '>' { if data[linkOffset] == '<' && data[linkEnd-1] == '>' {
linkOffset++ linkOffset++
@ -799,7 +804,17 @@ func ispunct(c byte) bool {
// Test if a character is a whitespace character. // Test if a character is a whitespace character.
func isspace(c byte) bool { func isspace(c byte) bool {
return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v' return ishorizontalspace(c) || isverticalspace(c)
}
// Test if a character is a horizontal whitespace character.
func ishorizontalspace(c byte) bool {
return c == ' ' || c == '\t'
}
// Test if a character is a vertical whitespace character.
func isverticalspace(c byte) bool {
return c == '\n' || c == '\r' || c == '\f' || c == '\v'
} }
// Test if a character is letter. // Test if a character is letter.

View File

@ -39,7 +39,7 @@ func isdigit(c byte) bool {
return c >= '0' && c <= '9' return c >= '0' && c <= '9'
} }
func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote byte, isOpen *bool) bool { func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote byte, isOpen *bool, addNBSP bool) bool {
// edge of the buffer is likely to be a tag that we don't get to see, // edge of the buffer is likely to be a tag that we don't get to see,
// so we treat it like text sometimes // so we treat it like text sometimes
@ -96,6 +96,12 @@ func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote
*isOpen = false *isOpen = false
} }
// Note that with the limited lookahead, this non-breaking
// space will also be appended to single double quotes.
if addNBSP && !*isOpen {
out.WriteString("&nbsp;")
}
out.WriteByte('&') out.WriteByte('&')
if *isOpen { if *isOpen {
out.WriteByte('l') out.WriteByte('l')
@ -104,6 +110,11 @@ func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote
} }
out.WriteByte(quote) out.WriteByte(quote)
out.WriteString("quo;") out.WriteString("quo;")
if addNBSP && *isOpen {
out.WriteString("&nbsp;")
}
return true return true
} }
@ -116,7 +127,7 @@ func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byt
if len(text) >= 3 { if len(text) >= 3 {
nextChar = text[2] nextChar = text[2]
} }
if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote) { if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) {
return 1 return 1
} }
} }
@ -141,7 +152,7 @@ func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byt
if len(text) > 1 { if len(text) > 1 {
nextChar = text[1] nextChar = text[1]
} }
if smartQuoteHelper(out, previousChar, nextChar, 's', &smrt.inSingleQuote) { if smartQuoteHelper(out, previousChar, nextChar, 's', &smrt.inSingleQuote, false) {
return 0 return 0
} }
@ -205,13 +216,13 @@ func smartDashLatex(out *bytes.Buffer, smrt *smartypantsData, previousChar byte,
return 0 return 0
} }
func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte) int { func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte, addNBSP bool) int {
if bytes.HasPrefix(text, []byte("&quot;")) { if bytes.HasPrefix(text, []byte("&quot;")) {
nextChar := byte(0) nextChar := byte(0)
if len(text) >= 7 { if len(text) >= 7 {
nextChar = text[6] nextChar = text[6]
} }
if smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote) { if smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, addNBSP) {
return 5 return 5
} }
} }
@ -224,12 +235,15 @@ func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte
return 0 return 0
} }
func smartAmp(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { func smartAmp(angledQuotes, addNBSP bool) func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
return smartAmpVariant(out, smrt, previousChar, text, 'd') var quote byte = 'd'
} if angledQuotes {
quote = 'a'
}
func smartAmpAngledQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { return func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
return smartAmpVariant(out, smrt, previousChar, text, 'a') return smartAmpVariant(out, smrt, previousChar, text, quote, addNBSP)
}
} }
func smartPeriod(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { func smartPeriod(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
@ -253,7 +267,7 @@ func smartBacktick(out *bytes.Buffer, smrt *smartypantsData, previousChar byte,
if len(text) >= 3 { if len(text) >= 3 {
nextChar = text[2] nextChar = text[2]
} }
if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote) { if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) {
return 1 return 1
} }
} }
@ -337,7 +351,7 @@ func smartDoubleQuoteVariant(out *bytes.Buffer, smrt *smartypantsData, previousC
if len(text) > 1 { if len(text) > 1 {
nextChar = text[1] nextChar = text[1]
} }
if !smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote) { if !smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, false) {
out.WriteString("&quot;") out.WriteString("&quot;")
} }
@ -367,14 +381,30 @@ type smartCallback func(out *bytes.Buffer, smrt *smartypantsData, previousChar b
type smartypantsRenderer [256]smartCallback type smartypantsRenderer [256]smartCallback
var (
smartAmpAngled = smartAmp(true, false)
smartAmpAngledNBSP = smartAmp(true, true)
smartAmpRegular = smartAmp(false, false)
smartAmpRegularNBSP = smartAmp(false, true)
)
func smartypants(flags int) *smartypantsRenderer { func smartypants(flags int) *smartypantsRenderer {
r := new(smartypantsRenderer) r := new(smartypantsRenderer)
addNBSP := flags&HTML_SMARTYPANTS_QUOTES_NBSP != 0
if flags&HTML_SMARTYPANTS_ANGLED_QUOTES == 0 { if flags&HTML_SMARTYPANTS_ANGLED_QUOTES == 0 {
r['"'] = smartDoubleQuote r['"'] = smartDoubleQuote
r['&'] = smartAmp if !addNBSP {
r['&'] = smartAmpRegular
} else {
r['&'] = smartAmpRegularNBSP
}
} else { } else {
r['"'] = smartAngledDoubleQuote r['"'] = smartAngledDoubleQuote
r['&'] = smartAmpAngledQuote if !addNBSP {
r['&'] = smartAmpAngled
} else {
r['&'] = smartAmpAngledNBSP
}
} }
r['\''] = smartSingleQuote r['\''] = smartSingleQuote
r['('] = smartParens r['('] = smartParens

View File

@ -1,10 +0,0 @@
language: go
go:
- 1.5
install:
- go get golang.org/x/tools/cmd/vet
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d -s .)
- go tool vet .
- go test -v -race ./...

View File

@ -1,23 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importmap = "k8s.io/kubernetes/vendor/github.com/shurcooL/sanitized_anchor_name",
importpath = "github.com/shurcooL/sanitized_anchor_name",
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -1,19 +0,0 @@
Copyright (c) 2015 Dmitri Shuralyov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,31 +0,0 @@
# sanitized_anchor_name [![Build Status](https://travis-ci.org/shurcooL/sanitized_anchor_name.svg?branch=master)](https://travis-ci.org/shurcooL/sanitized_anchor_name) [![GoDoc](https://godoc.org/github.com/shurcooL/sanitized_anchor_name?status.svg)](https://godoc.org/github.com/shurcooL/sanitized_anchor_name)
Package sanitized_anchor_name provides a func to create sanitized anchor names.
Its logic can be reused by multiple packages to create interoperable anchor names and links to those anchors.
At this time, it does not try to ensure that generated anchor names are unique, that responsibility falls on the caller.
Installation
------------
```bash
go get -u github.com/shurcooL/sanitized_anchor_name
```
Example
-------
```Go
anchorName := sanitized_anchor_name.Create("This is a header")
fmt.Println(anchorName)
// Output:
// this-is-a-header
```
License
-------
- [MIT License](LICENSE)

View File

@ -1,29 +0,0 @@
// Package sanitized_anchor_name provides a func to create sanitized anchor names.
//
// Its logic can be reused by multiple packages to create interoperable anchor names
// and links to those anchors.
//
// At this time, it does not try to ensure that generated anchor names
// are unique, that responsibility falls on the caller.
package sanitized_anchor_name // import "github.com/shurcooL/sanitized_anchor_name"
import "unicode"
// Create returns a sanitized anchor name for the given text.
func Create(text string) string {
var anchorName []rune
var futureDash = false
for _, r := range []rune(text) {
switch {
case unicode.IsLetter(r) || unicode.IsNumber(r):
if futureDash && len(anchorName) > 0 {
anchorName = append(anchorName, '-')
}
futureDash = false
anchorName = append(anchorName, unicode.ToLower(r))
default:
futureDash = true
}
}
return string(anchorName)
}

4
vendor/modules.txt vendored
View File

@ -726,14 +726,12 @@ github.com/quobyte/api
github.com/robfig/cron github.com/robfig/cron
# github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c # github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c => github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c
github.com/rubiojr/go-vhd/vhd github.com/rubiojr/go-vhd/vhd
# github.com/russross/blackfriday v1.5.2 => github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 # github.com/russross/blackfriday v1.5.2 => github.com/russross/blackfriday v1.5.2
github.com/russross/blackfriday github.com/russross/blackfriday
# github.com/satori/go.uuid v1.2.0 => github.com/satori/go.uuid v1.2.0 # github.com/satori/go.uuid v1.2.0 => github.com/satori/go.uuid v1.2.0
github.com/satori/go.uuid github.com/satori/go.uuid
# github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e => github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e # github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e => github.com/seccomp/libseccomp-golang v0.0.0-20150813023252-1b506fc7c24e
github.com/seccomp/libseccomp-golang github.com/seccomp/libseccomp-golang
# github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db => github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db
github.com/shurcooL/sanitized_anchor_name
# github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d => github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d # github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d => github.com/sigma/go-inotify v0.0.0-20181102212354-c87b6cf5033d
github.com/sigma/go-inotify github.com/sigma/go-inotify
# github.com/sirupsen/logrus v1.2.0 => github.com/sirupsen/logrus v1.2.0 # github.com/sirupsen/logrus v1.2.0 => github.com/sirupsen/logrus v1.2.0