diff options
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/content.go | 6 | ||||
-rw-r--r-- | helpers/content_test.go | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/helpers/content.go b/helpers/content.go index 4a46ecb77..1c0a7b7e9 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -109,6 +109,7 @@ type BlackFriday struct { Fractions bool HrefTargetBlank bool NofollowLinks bool + NoreferrerLinks bool SmartDashes bool LatexDashes bool TaskLists bool @@ -126,6 +127,7 @@ func newBlackfriday(config map[string]interface{}) *BlackFriday { "fractions": true, "hrefTargetBlank": false, "nofollowLinks": false, + "noreferrerLinks": false, "smartDashes": true, "latexDashes": true, "plainIDAnchors": true, @@ -283,6 +285,10 @@ func (c *ContentSpec) getHTMLRenderer(defaultFlags int, ctx *RenderingContext) b htmlFlags |= blackfriday.HTML_NOFOLLOW_LINKS } + if ctx.Config.NoreferrerLinks { + htmlFlags |= blackfriday.HTML_NOREFERRER_LINKS + } + if ctx.Config.SmartDashes { htmlFlags |= blackfriday.HTML_SMARTYPANTS_DASHES } diff --git a/helpers/content_test.go b/helpers/content_test.go index fe670bd74..5297df2de 100644 --- a/helpers/content_test.go +++ b/helpers/content_test.go @@ -205,6 +205,7 @@ func TestGetHTMLRendererAllFlags(t *testing.T) { {blackfriday.HTML_SMARTYPANTS_FRACTIONS}, {blackfriday.HTML_HREF_TARGET_BLANK}, {blackfriday.HTML_NOFOLLOW_LINKS}, + {blackfriday.HTML_NOREFERRER_LINKS}, {blackfriday.HTML_SMARTYPANTS_DASHES}, {blackfriday.HTML_SMARTYPANTS_LATEX_DASHES}, } @@ -214,6 +215,7 @@ func TestGetHTMLRendererAllFlags(t *testing.T) { ctx.Config.Fractions = true ctx.Config.HrefTargetBlank = true ctx.Config.NofollowLinks = true + ctx.Config.NoreferrerLinks = true ctx.Config.LatexDashes = true ctx.Config.PlainIDAnchors = true ctx.Config.SmartDashes = true |