mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-11 20:03:58 +02:00
Add site-wide/per-page [blackfriday] fractions
option
Make Blackfriday's `HTML_SMARTYPANTS_FRACTIONS` option user-configurable. Defaults to `true` as before. See discussions at: http://discuss.gohugo.io/t/any-way-to-disable-smart-fractions/328 Thanks to @bjornerik and @spf13 for laying the groundwork making it easy to expose Blackfriday's underlying configurable options.
This commit is contained in:
@@ -95,11 +95,10 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
|
||||
htmlFlags := defaultFlags
|
||||
htmlFlags |= blackfriday.HTML_USE_XHTML
|
||||
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
|
||||
htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
|
||||
|
||||
var angledQuotes bool
|
||||
var angledQuotes, fractions bool
|
||||
|
||||
if m, ok := ctx.ConfigFlags["angledQuotes"]; ok {
|
||||
angledQuotes = m
|
||||
@@ -109,6 +108,14 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
|
||||
}
|
||||
|
||||
if m, ok := ctx.ConfigFlags["fractions"]; ok {
|
||||
fractions = m
|
||||
}
|
||||
|
||||
if fractions {
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
|
||||
}
|
||||
|
||||
return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user