mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Add option to disable Blackfriday LaTeX style dashes
Can be used in site config of per page front matter: ``` [blackfriday] latexDashes = false ``` Fixes #1231
This commit is contained in:
parent
664a97819f
commit
05c07c561a
1 changed files with 6 additions and 1 deletions
|
@ -42,6 +42,7 @@ var SummaryDivider = []byte("<!--more-->")
|
|||
type Blackfriday struct {
|
||||
AngledQuotes bool
|
||||
Fractions bool
|
||||
LatexDashes bool
|
||||
PlainIDAnchors bool
|
||||
Extensions []string
|
||||
ExtensionsMask []string
|
||||
|
@ -52,6 +53,7 @@ func NewBlackfriday() *Blackfriday {
|
|||
return &Blackfriday{
|
||||
AngledQuotes: false,
|
||||
Fractions: true,
|
||||
LatexDashes: true,
|
||||
PlainIDAnchors: false,
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +147,6 @@ func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render
|
|||
htmlFlags := defaultFlags
|
||||
htmlFlags |= blackfriday.HTML_USE_XHTML
|
||||
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
|
||||
htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
|
||||
|
||||
if ctx.getConfig().AngledQuotes {
|
||||
|
@ -156,6 +157,10 @@ func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render
|
|||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_FRACTIONS
|
||||
}
|
||||
|
||||
if ctx.getConfig().LatexDashes {
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
|
||||
}
|
||||
|
||||
return blackfriday.HtmlRendererWithParameters(htmlFlags, "", "", renderParameters)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue