all repos — grayfriday @ cf9a62808d00fa2ad70c74f209c0012f56e7a822

blackfriday fork with a few changes

Revert module name
Anirudh Oppiliappan x@icyphox.sh
Mon, 19 Dec 2022 09:16:07 +0530
commit

cf9a62808d00fa2ad70c74f209c0012f56e7a822

parent

1ea5187864197107ca6647892ff3a4b95c5be8d1

4 files changed, 29 insertions(+), 23 deletions(-)

jump to
M doc.godoc.go

@@ -16,7 +16,7 @@ //

// If you're interested in calling Blackfriday from command line, see // https://github.com/russross/blackfriday-tool. // -// Sanitized Anchor Names +// # Sanitized Anchor Names // // Blackfriday includes an algorithm for creating sanitized anchor names // corresponding to a given input text. This algorithm is used to create
M go.modgo.mod

@@ -1,3 +1,3 @@

-module icyphox.sh/grayfriday +module git.icyphox.sh/grayfriday go 1.19
M inline.goinline.go

@@ -769,7 +769,9 @@ return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd

} // 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 // anything from Unicode and that's very slow. Since this func will only be // used on ASCII protocol prefixes, we can take shortcuts.
M markdown.gomarkdown.go

@@ -345,8 +345,8 @@ //

// 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: // -// * [link text][refid] -// * [refid][] +// - [link text][refid] +// - [refid][] // // 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

@@ -363,7 +363,9 @@ // Run is the main entry point to Blackfriday. It parses and renders a

// block of markdown-encoded text. // // 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 // the default HTMLRenderer (with CommonHTMLFlags). //

@@ -371,13 +373,15 @@ // Variadic arguments opts can customize the default behavior. Since Markdown

// 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 // functionality, with no extensions: -// output := Run(input, WithNoExtensions()) +// +// output := Run(input, WithNoExtensions()) // // 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 // former: -// output := Run(input, WithNoExtensions(), WithExtensions(exts), -// WithRenderer(yourRenderer)) +// +// output := Run(input, WithNoExtensions(), WithExtensions(exts), +// WithRenderer(yourRenderer)) func Run(input []byte, opts ...Option) []byte { r := NewHTMLRenderer(HTMLRendererParameters{ Flags: CommonHTMLFlags,

@@ -491,35 +495,35 @@ // footnotes.

// // 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: // -// <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: // -// p.refs["ref"] = &reference{ -// link: "/url/", -// title: "tooltip title", -// } +// p.refs["ref"] = &reference{ +// link: "/url/", +// title: "tooltip title", +// } // // Alternatively, reference can contain information about a footnote. Consider // 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: // -// p.refs["a"] = &reference{ -// link: "a", -// title: "This is the note", -// noteID: <some positive int>, -// } +// p.refs["a"] = &reference{ +// link: "a", +// title: "This is the note", +// noteID: <some positive int>, +// } // // TODO: As you can see, it begs for splitting into two dedicated structures // for refs and for footnotes.