mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
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:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user