ref: 483fc8fa3dd8db7d399ef5ed05a3b7f42ea19152
parent: 05c07c561a44539c0691cca2ba71c7bd48064946
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Jun 28 11:18:15 EDT 2015
Add config option for Blackfriday HTML_HREF_TARGET_BLANK Fixes #1220
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -40,21 +40,23 @@
// Blackfriday holds configuration values for Blackfriday rendering.
type Blackfriday struct {
- AngledQuotes bool
- Fractions bool
- LatexDashes bool
- PlainIDAnchors bool
- Extensions []string
- ExtensionsMask []string
+ AngledQuotes bool
+ Fractions bool
+ HrefTargetBlank bool
+ LatexDashes bool
+ PlainIDAnchors bool
+ Extensions []string
+ ExtensionsMask []string
}
// NewBlackfriday creates a new Blackfriday with some sane defaults.
func NewBlackfriday() *Blackfriday {
return &Blackfriday{
- AngledQuotes: false,
- Fractions: true,
- LatexDashes: true,
- PlainIDAnchors: false,
+ AngledQuotes: false,
+ Fractions: true,
+ HrefTargetBlank: false,
+ LatexDashes: true,
+ PlainIDAnchors: false,
}
}
@@ -155,6 +157,10 @@
if ctx.getConfig().Fractions {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
+ }
+
+ if ctx.getConfig().HrefTargetBlank {
+ htmlFlags |= blackfriday.HTML_HREF_TARGET_BLANK
}
if ctx.getConfig().LatexDashes {