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:
Bjørn Erik Pedersen 2015-06-28 15:08:52 +02:00
parent 664a97819f
commit 05c07c561a

View file

@ -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)
}