Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Fok <foka@debian.org>2015-08-04 22:05:48 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2015-08-04 22:42:32 +0300
commit4a2eda49cdd3180ab884a696ac987d7d6bb375db (patch)
tree407d72ec268819050b62c39a41f161acf8919183 /helpers
parenteb519afefdd506de46968f598fe78af7cda49dee (diff)
Add option to disable Blackfriday Smartypants
Can be used in site config or per page front matter: ``` [blackfriday] smartypants = false ```
Diffstat (limited to 'helpers')
-rw-r--r--helpers/content.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/helpers/content.go b/helpers/content.go
index 86c3f8c5a..8e3fda505 100644
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -40,6 +40,7 @@ var SummaryDivider = []byte("<!--more-->")
// Blackfriday holds configuration values for Blackfriday rendering.
type Blackfriday struct {
+ Smartypants bool
AngledQuotes bool
Fractions bool
HrefTargetBlank bool
@@ -52,6 +53,7 @@ type Blackfriday struct {
// NewBlackfriday creates a new Blackfriday with some sane defaults.
func NewBlackfriday() *Blackfriday {
return &Blackfriday{
+ Smartypants: true,
AngledQuotes: false,
Fractions: true,
HrefTargetBlank: false,
@@ -148,9 +150,12 @@ func GetHTMLRenderer(defaultFlags int, ctx *RenderingContext) blackfriday.Render
htmlFlags := defaultFlags
htmlFlags |= blackfriday.HTML_USE_XHTML
- htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
htmlFlags |= blackfriday.HTML_FOOTNOTE_RETURN_LINKS
+ if ctx.getConfig().Smartypants {
+ htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
+ }
+
if ctx.getConfig().AngledQuotes {
htmlFlags |= blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES
}