From 81ab859a7bb8ee6ee9411639561642069ec4cd6a Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Sat, 20 Feb 2021 10:22:23 -0800 Subject: [PATCH] Upgrade blackfriday to v2 and fix underscore italics (#350) Now that we have a go.mod, we can properly upgrade to blackfriday/v2 The output remains the same, but this PR brings back italic links with '_', placing them into the link since this seems to be the more proper way. Fixes #182 --- examples/mutexes/mutexes.go | 2 +- examples/mutexes/mutexes.hash | 4 +- examples/rate-limiting/rate-limiting.go | 2 +- examples/rate-limiting/rate-limiting.hash | 4 +- go.mod | 5 +- go.sum | 2 + public/mutexes | 4 +- public/rate-limiting | 4 +- tools/generate.go | 4 +- .../russross/blackfriday/LICENSE.txt | 28 - vendor/github.com/russross/blackfriday/go.mod | 3 - .../github.com/russross/blackfriday/html.go | 945 ------- .../github.com/russross/blackfriday/latex.go | 334 --- .../russross/blackfriday/{ => v2}/.gitignore | 0 .../russross/blackfriday/{ => v2}/.travis.yml | 3 +- .../russross/blackfriday/v2/LICENSE.txt | 29 + .../russross/blackfriday/{ => v2}/README.md | 49 +- .../russross/blackfriday/{ => v2}/block.go | 838 +++--- .../russross/blackfriday/{ => v2}/doc.go | 22 +- .../russross/blackfriday/v2/entities.go | 2236 +++++++++++++++++ .../github.com/russross/blackfriday/v2/esc.go | 70 + .../github.com/russross/blackfriday/v2/go.mod | 1 + .../russross/blackfriday/v2/html.go | 952 +++++++ .../russross/blackfriday/{ => v2}/inline.go | 570 +++-- .../russross/blackfriday/{ => v2}/markdown.go | 687 ++--- .../russross/blackfriday/v2/node.go | 360 +++ .../blackfriday/{ => v2}/smartypants.go | 139 +- vendor/modules.txt | 4 +- 28 files changed, 4935 insertions(+), 2366 deletions(-) delete mode 100644 vendor/github.com/russross/blackfriday/LICENSE.txt delete mode 100644 vendor/github.com/russross/blackfriday/go.mod delete mode 100644 vendor/github.com/russross/blackfriday/html.go delete mode 100644 vendor/github.com/russross/blackfriday/latex.go rename vendor/github.com/russross/blackfriday/{ => v2}/.gitignore (100%) rename vendor/github.com/russross/blackfriday/{ => v2}/.travis.yml (90%) create mode 100644 vendor/github.com/russross/blackfriday/v2/LICENSE.txt rename vendor/github.com/russross/blackfriday/{ => v2}/README.md (90%) rename vendor/github.com/russross/blackfriday/{ => v2}/block.go (57%) rename vendor/github.com/russross/blackfriday/{ => v2}/doc.go (59%) create mode 100644 vendor/github.com/russross/blackfriday/v2/entities.go create mode 100644 vendor/github.com/russross/blackfriday/v2/esc.go create mode 100644 vendor/github.com/russross/blackfriday/v2/go.mod create mode 100644 vendor/github.com/russross/blackfriday/v2/html.go rename vendor/github.com/russross/blackfriday/{ => v2}/inline.go (63%) rename vendor/github.com/russross/blackfriday/{ => v2}/markdown.go (50%) create mode 100644 vendor/github.com/russross/blackfriday/v2/node.go rename vendor/github.com/russross/blackfriday/{ => v2}/smartypants.go (66%) diff --git a/examples/mutexes/mutexes.go b/examples/mutexes/mutexes.go index 79b0c31..59e736d 100644 --- a/examples/mutexes/mutexes.go +++ b/examples/mutexes/mutexes.go @@ -1,6 +1,6 @@ // In the previous example we saw how to manage simple // counter state using [atomic operations](atomic-counters). -// For more complex state we can use a [mutex](http://en.wikipedia.org/wiki/Mutual_exclusion) +// For more complex state we can use a [_mutex_](http://en.wikipedia.org/wiki/Mutual_exclusion) // to safely access data across multiple goroutines. package main diff --git a/examples/mutexes/mutexes.hash b/examples/mutexes/mutexes.hash index 95b8135..4455e8c 100644 --- a/examples/mutexes/mutexes.hash +++ b/examples/mutexes/mutexes.hash @@ -1,2 +1,2 @@ -7cb6349117087c78ddb71c240e988ec8281c8952 -0WEmOOjoCjp +253b089b8145fc57a90ae4024346b6db2ec1659b +CHCDredHCOz diff --git a/examples/rate-limiting/rate-limiting.go b/examples/rate-limiting/rate-limiting.go index c32483d..d890e7f 100644 --- a/examples/rate-limiting/rate-limiting.go +++ b/examples/rate-limiting/rate-limiting.go @@ -1,4 +1,4 @@ -// [Rate limiting](http://en.wikipedia.org/wiki/Rate_limiting) +// [_Rate limiting_](http://en.wikipedia.org/wiki/Rate_limiting) // is an important mechanism for controlling resource // utilization and maintaining quality of service. Go // elegantly supports rate limiting with goroutines, diff --git a/examples/rate-limiting/rate-limiting.hash b/examples/rate-limiting/rate-limiting.hash index 813cbef..adb0bfc 100644 --- a/examples/rate-limiting/rate-limiting.hash +++ b/examples/rate-limiting/rate-limiting.hash @@ -1,2 +1,2 @@ -c2d4dd4c2121e61395db186e3f15ce8cb3acf643 -20c_m1AtOEI +c7063265708287744ea172ed9ed1390043140718 +GXjXHfnKFXg diff --git a/go.mod b/go.mod index 83e7676..fd33949 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module github.com/mmcgrana/gobyexample go 1.15 -require github.com/russross/blackfriday v1.6.0 +require ( + github.com/russross/blackfriday v1.6.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 +) diff --git a/go.sum b/go.sum index 270cecf..1386288 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= diff --git a/public/mutexes b/public/mutexes index e97f94b..cdd33e7 100644 --- a/public/mutexes +++ b/public/mutexes @@ -29,7 +29,7 @@

In the previous example we saw how to manage simple counter state using atomic operations. -For more complex state we can use a mutex +For more complex state we can use a mutex to safely access data across multiple goroutines.

@@ -44,7 +44,7 @@ to safely access data across multiple goroutines.

- +
package main
 
diff --git a/public/rate-limiting b/public/rate-limiting index 06a79ff..5f4be39 100644 --- a/public/rate-limiting +++ b/public/rate-limiting @@ -27,7 +27,7 @@ -

Rate limiting +

Rate limiting is an important mechanism for controlling resource utilization and maintaining quality of service. Go elegantly supports rate limiting with goroutines, @@ -45,7 +45,7 @@ channels, and tickers.

- +
package main
 
diff --git a/tools/generate.go b/tools/generate.go index 3adacf1..ebf0076 100644 --- a/tools/generate.go +++ b/tools/generate.go @@ -12,7 +12,7 @@ import ( "strings" "text/template" - "github.com/russross/blackfriday" + "github.com/russross/blackfriday/v2" ) // siteDir is the target directory into which the HTML gets generated. Its @@ -94,7 +94,7 @@ func cachedPygmentize(lex string, src string) string { } func markdown(src string) string { - return string(blackfriday.MarkdownCommon([]byte(src))) + return string(blackfriday.Run([]byte(src))) } func readLines(path string) []string { diff --git a/vendor/github.com/russross/blackfriday/LICENSE.txt b/vendor/github.com/russross/blackfriday/LICENSE.txt deleted file mode 100644 index 7fbb253..0000000 --- a/vendor/github.com/russross/blackfriday/LICENSE.txt +++ /dev/null @@ -1,28 +0,0 @@ -Blackfriday is distributed under the Simplified BSD License: - -Copyright © 2011 Russ Ross -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with - the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/russross/blackfriday/go.mod b/vendor/github.com/russross/blackfriday/go.mod deleted file mode 100644 index d0f058a..0000000 --- a/vendor/github.com/russross/blackfriday/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/russross/blackfriday - -go 1.13 diff --git a/vendor/github.com/russross/blackfriday/html.go b/vendor/github.com/russross/blackfriday/html.go deleted file mode 100644 index fa044ca..0000000 --- a/vendor/github.com/russross/blackfriday/html.go +++ /dev/null @@ -1,945 +0,0 @@ -// -// Blackfriday Markdown Processor -// Available at http://github.com/russross/blackfriday -// -// Copyright © 2011 Russ Ross . -// Distributed under the Simplified BSD License. -// See README.md for details. -// - -// -// -// HTML rendering backend -// -// - -package blackfriday - -import ( - "bytes" - "fmt" - "regexp" - "strconv" - "strings" -) - -// Html renderer configuration options. -const ( - HTML_SKIP_HTML = 1 << iota // skip preformatted HTML blocks - HTML_SKIP_STYLE // skip embedded