mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-30 04:29:13 +01:00
Change namespace for PR
This commit is contained in:
parent
46f3fff6e1
commit
2c1e9331ba
2
block.go
2
block.go
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
@ -1589,7 +1589,7 @@ func TestListWithFencedCodeBlock(t *testing.T) {
|
|||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1. one\n\n ```\n code\n ```\n\n2. two\n",
|
"1. one\n\n ```\n code\n ```\n\n2. two\n",
|
||||||
"<ol>\n<li><p>one</p>\n\n<pre><code>code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",
|
"<ol>\n<li><p>one</p>\n\n<pre><code>code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",
|
||||||
// https://github.com/danog/blackfriday/issues/239
|
// https://github.com/russross/blackfriday/issues/239
|
||||||
"1. one\n\n ```\n - code\n ```\n\n2. two\n",
|
"1. one\n\n ```\n - code\n ```\n\n2. two\n",
|
||||||
"<ol>\n<li><p>one</p>\n\n<pre><code>- code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",
|
"<ol>\n<li><p>one</p>\n\n<pre><code>- code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",
|
||||||
}
|
}
|
||||||
@ -1600,7 +1600,7 @@ func TestListWithMalformedFencedCodeBlock(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
// Ensure that in the case of an unclosed fenced code block in a list,
|
// Ensure that in the case of an unclosed fenced code block in a list,
|
||||||
// no source gets ommitted (even if it is malformed).
|
// no source gets ommitted (even if it is malformed).
|
||||||
// See danog/blackfriday#372 for context.
|
// See russross/blackfriday#372 for context.
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1. one\n\n ```\n code\n\n2. two\n",
|
"1. one\n\n ```\n code\n\n2. two\n",
|
||||||
"<ol>\n<li>one\n```\ncode\n2. two</li>\n</ol>\n",
|
"<ol>\n<li>one\n```\ncode\n2. two</li>\n</ol>\n",
|
||||||
|
4
doc.go
4
doc.go
@ -14,9 +14,9 @@
|
|||||||
// to the Markdown processor.
|
// to the Markdown processor.
|
||||||
//
|
//
|
||||||
// If you're interested in calling Blackfriday from command line, see
|
// If you're interested in calling Blackfriday from command line, see
|
||||||
// https://github.com/danog/blackfriday-tool.
|
// https://github.com/russross/blackfriday-tool.
|
||||||
//
|
//
|
||||||
// Sanitized Anchor Names
|
// # Sanitized Anchor Names
|
||||||
//
|
//
|
||||||
// Blackfriday includes an algorithm for creating sanitized anchor names
|
// Blackfriday includes an algorithm for creating sanitized anchor names
|
||||||
// corresponding to a given input text. This algorithm is used to create
|
// corresponding to a given input text. This algorithm is used to create
|
||||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
|||||||
module github.com/danog/blackfriday/v2
|
module github.com/russross/blackfriday/v2
|
||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
|
2
html.go
2
html.go
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
@ -735,7 +735,9 @@ func linkEndsWithEntity(data []byte, linkEnd int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hasPrefixCaseInsensitive is a custom implementation of
|
// hasPrefixCaseInsensitive is a custom implementation of
|
||||||
// strings.HasPrefix(strings.ToLower(s), prefix)
|
//
|
||||||
|
// strings.HasPrefix(strings.ToLower(s), prefix)
|
||||||
|
//
|
||||||
// we rolled our own because ToLower pulls in a huge machinery of lowercasing
|
// we rolled our own because ToLower pulls in a huge machinery of lowercasing
|
||||||
// anything from Unicode and that's very slow. Since this func will only be
|
// anything from Unicode and that's very slow. Since this func will only be
|
||||||
// used on ASCII protocol prefixes, we can take shortcuts.
|
// used on ASCII protocol prefixes, we can take shortcuts.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
|
46
markdown.go
46
markdown.go
@ -1,5 +1,5 @@
|
|||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
@ -345,8 +345,8 @@ func WithNoExtensions() Option {
|
|||||||
// In Markdown, the link reference syntax can be made to resolve a link to
|
// In Markdown, the link reference syntax can be made to resolve a link to
|
||||||
// a reference instead of an inline URL, in one of the following ways:
|
// a reference instead of an inline URL, in one of the following ways:
|
||||||
//
|
//
|
||||||
// * [link text][refid]
|
// - [link text][refid]
|
||||||
// * [refid][]
|
// - [refid][]
|
||||||
//
|
//
|
||||||
// Usually, the refid is defined at the bottom of the Markdown document. If
|
// Usually, the refid is defined at the bottom of the Markdown document. If
|
||||||
// this override function is provided, the refid is passed to the override
|
// this override function is provided, the refid is passed to the override
|
||||||
@ -363,7 +363,9 @@ func WithRefOverride(o ReferenceOverrideFunc) Option {
|
|||||||
// block of markdown-encoded text.
|
// block of markdown-encoded text.
|
||||||
//
|
//
|
||||||
// The simplest invocation of Run takes one argument, input:
|
// The simplest invocation of Run takes one argument, input:
|
||||||
// output := Run(input)
|
//
|
||||||
|
// output := Run(input)
|
||||||
|
//
|
||||||
// This will parse the input with CommonExtensions enabled and render it with
|
// This will parse the input with CommonExtensions enabled and render it with
|
||||||
// the default HTMLRenderer (with CommonHTMLFlags).
|
// the default HTMLRenderer (with CommonHTMLFlags).
|
||||||
//
|
//
|
||||||
@ -371,13 +373,15 @@ func WithRefOverride(o ReferenceOverrideFunc) Option {
|
|||||||
// type does not contain exported fields, you can not use it directly. Instead,
|
// type does not contain exported fields, you can not use it directly. Instead,
|
||||||
// use the With* functions. For example, this will call the most basic
|
// use the With* functions. For example, this will call the most basic
|
||||||
// functionality, with no extensions:
|
// functionality, with no extensions:
|
||||||
// output := Run(input, WithNoExtensions())
|
//
|
||||||
|
// output := Run(input, WithNoExtensions())
|
||||||
//
|
//
|
||||||
// You can use any number of With* arguments, even contradicting ones. They
|
// You can use any number of With* arguments, even contradicting ones. They
|
||||||
// will be applied in order of appearance and the latter will override the
|
// will be applied in order of appearance and the latter will override the
|
||||||
// former:
|
// former:
|
||||||
// output := Run(input, WithNoExtensions(), WithExtensions(exts),
|
//
|
||||||
// WithRenderer(yourRenderer))
|
// output := Run(input, WithNoExtensions(), WithExtensions(exts),
|
||||||
|
// WithRenderer(yourRenderer))
|
||||||
func Run(input []byte, opts ...Option) []byte {
|
func Run(input []byte, opts ...Option) []byte {
|
||||||
r := NewHTMLRenderer(HTMLRendererParameters{
|
r := NewHTMLRenderer(HTMLRendererParameters{
|
||||||
Flags: CommonHTMLFlags,
|
Flags: CommonHTMLFlags,
|
||||||
@ -491,35 +495,35 @@ func (p *Markdown) parseRefsToAST() {
|
|||||||
//
|
//
|
||||||
// Consider this markdown with reference-style links:
|
// Consider this markdown with reference-style links:
|
||||||
//
|
//
|
||||||
// [link][ref]
|
// [link][ref]
|
||||||
//
|
//
|
||||||
// [ref]: /url/ "tooltip title"
|
// [ref]: /url/ "tooltip title"
|
||||||
//
|
//
|
||||||
// It will be ultimately converted to this HTML:
|
// It will be ultimately converted to this HTML:
|
||||||
//
|
//
|
||||||
// <p><a href=\"/url/\" title=\"title\">link</a></p>
|
// <p><a href=\"/url/\" title=\"title\">link</a></p>
|
||||||
//
|
//
|
||||||
// And a reference structure will be populated as follows:
|
// And a reference structure will be populated as follows:
|
||||||
//
|
//
|
||||||
// p.refs["ref"] = &reference{
|
// p.refs["ref"] = &reference{
|
||||||
// link: "/url/",
|
// link: "/url/",
|
||||||
// title: "tooltip title",
|
// title: "tooltip title",
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Alternatively, reference can contain information about a footnote. Consider
|
// Alternatively, reference can contain information about a footnote. Consider
|
||||||
// this markdown:
|
// this markdown:
|
||||||
//
|
//
|
||||||
// Text needing a footnote.[^a]
|
// Text needing a footnote.[^a]
|
||||||
//
|
//
|
||||||
// [^a]: This is the note
|
// [^a]: This is the note
|
||||||
//
|
//
|
||||||
// A reference structure will be populated as follows:
|
// A reference structure will be populated as follows:
|
||||||
//
|
//
|
||||||
// p.refs["a"] = &reference{
|
// p.refs["a"] = &reference{
|
||||||
// link: "a",
|
// link: "a",
|
||||||
// title: "This is the note",
|
// title: "This is the note",
|
||||||
// noteID: <some positive int>,
|
// noteID: <some positive int>,
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// TODO: As you can see, it begs for splitting into two dedicated structures
|
// TODO: As you can see, it begs for splitting into two dedicated structures
|
||||||
// for refs and for footnotes.
|
// for refs and for footnotes.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
@ -26,12 +26,12 @@ func TestDocument(t *testing.T) {
|
|||||||
"",
|
"",
|
||||||
|
|
||||||
// This shouldn't panic.
|
// This shouldn't panic.
|
||||||
// https://github.com/danog/blackfriday/issues/172
|
// https://github.com/russross/blackfriday/issues/172
|
||||||
"[]:<",
|
"[]:<",
|
||||||
"<p>[]:<</p>\n",
|
"<p>[]:<</p>\n",
|
||||||
|
|
||||||
// This shouldn't panic.
|
// This shouldn't panic.
|
||||||
// https://github.com/danog/blackfriday/issues/173
|
// https://github.com/russross/blackfriday/issues/173
|
||||||
" [",
|
" [",
|
||||||
"<p>[</p>\n",
|
"<p>[</p>\n",
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// Blackfriday Markdown Processor
|
// Blackfriday Markdown Processor
|
||||||
// Available at http://github.com/danog/blackfriday
|
// Available at http://github.com/russross/blackfriday
|
||||||
//
|
//
|
||||||
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
// Copyright © 2011 Russ Ross <russ@russross.com>.
|
||||||
// Distributed under the Simplified BSD License.
|
// Distributed under the Simplified BSD License.
|
||||||
|
Loading…
Reference in New Issue
Block a user