pull/402/merge
Duzy Chan 2020-08-10 18:05:50 -04:00 committed by GitHub
commit e724ba1d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

View File

@ -13,6 +13,22 @@ extensions.
It started as a translation from C of [Sundown][3].
About Duzy's fork
-----------------
The original Blackfirday can not process [empty links][empty-link-issue].
Empty links could be very useful for holding meta information to be
processed by application. For example:
``` markdown
[](
anything goes here should be ignored by renderer as the link is empty
)
```
In Duzy's fork, the parsing issue of empty links was fixed. Other possible
modification may happen if needed and differs from the original version.
Installation
------------
@ -308,3 +324,5 @@ License
[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"
[empty-link-issue]: https://github.com/russross/blackfriday/pull/402

2
go.mod
View File

@ -1 +1 @@
module github.com/russross/blackfriday/v2
module github.com/duzy/blackfriday

View File

@ -541,7 +541,9 @@ func link(p *Markdown, data []byte, offset int) (int, *Node) {
// links need something to click on and somewhere to go
if len(uLink) == 0 || (t == linkNormal && txtE <= 1) {
return 0, nil
if txtE == 1 && p.extensions&EmptyLink == 0 {
return 0, nil
}
}
}

View File

@ -47,13 +47,14 @@ const (
AutoHeadingIDs // Create the heading ID from the text
BackslashLineBreak // Translate trailing backslashes into line breaks
DefinitionLists // Render definition lists
EmptyLink // Parse empty links
CommonHTMLFlags HTMLFlags = UseXHTML | Smartypants |
SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes
CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode |
Autolink | Strikethrough | SpaceHeadings | HeadingIDs |
BackslashLineBreak | DefinitionLists
BackslashLineBreak | DefinitionLists | EmptyLink
)
// ListType contains bitwise or'ed flags for list and list item objects.