Add smartDashes flag for Blackfriday

To allow the end users to disable any form of smart dashes
(LaTeX-style or not) while keeping the rest of Blackfriday
SmartyPants features.

Depends on https://github.com/russross/blackfriday/pull/190
"Add HTML_SMARTYPANTS_DASHES for toggling smart dashes"
to be accepted by Blackfriday developers.
This commit is contained in:
Anthony Fok
2015-08-05 16:39:29 -06:00
parent 6b34a4e4e8
commit e95db67b20
2 changed files with 18 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ type Blackfriday struct {
AngledQuotes bool
Fractions bool
HrefTargetBlank bool
SmartDashes bool
LatexDashes bool
PlainIDAnchors bool
Extensions []string
@@ -58,6 +59,7 @@ func NewBlackfriday() *Blackfriday {
AngledQuotes: false,
Fractions: true,
HrefTargetBlank: false,
SmartDashes: true,
LatexDashes: true,
PlainIDAnchors: false,
}
@@ -169,6 +171,10 @@ func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render
htmlFlags |= blackfriday.HTML_HREF_TARGET_BLANK
}
if ctx.getConfig().SmartDashes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_DASHES
}
if ctx.getConfig().LatexDashes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
}