ref: cb9dfc2613ae5125cafa450097fb0f62dd3770e7
parent: c4a0b6e8abdf9f800fbd7a7f89e9f736edc60431
author: Bjørn Erik Pedersen <[email protected]>
date: Sat Jul 29 06:10:40 EDT 2017
helpers: Add support for French Guillemets Fixes #3725
--- a/docs/content/readfiles/bfconfig.md
+++ b/docs/content/readfiles/bfconfig.md
@@ -8,6 +8,11 @@
Blackfriday flag: **`HTML_USE_SMARTYPANTS`** <br>
Purpose: `false` disables smart punctuation substitutions, including smart quotes, smart dashes, smart fractions, etc. If `true`, it may be fine-tuned with the `angledQuotes`, `fractions`, `smartDashes`, and `latexDashes` flags (see below).
+`smartypantsQuotesNBSP`
+: default: **`false`** <br>
+ Blackfriday flag: **`HTML_SMARTYPANTS_QUOTES_NBSP`** <br>
+ Purpose: `true` enables French style Guillemets with non-breaking space inside the quotes.
+
`angledQuotes`
: default: **`false`**<br>
Blackfriday flag: **`HTML_SMARTYPANTS_ANGLED_QUOTES`**<br>
--- a/helpers/content.go
+++ b/helpers/content.go
@@ -63,6 +63,7 @@
// Blackfriday holds configuration values for Blackfriday rendering.
type Blackfriday struct {
Smartypants bool
+ SmartypantsQuotesNBSP bool
AngledQuotes bool
Fractions bool
HrefTargetBlank bool
@@ -81,6 +82,7 @@
defaultParam := map[string]interface{}{
"smartypants": true,
"angledQuotes": false,
+ "smartypantsQuotesNBSP": false,
"fractions": true,
"hrefTargetBlank": false,
"smartDashes": true,
@@ -227,6 +229,10 @@
if ctx.Config.Smartypants {
htmlFlags |= blackfriday.HTML_USE_SMARTYPANTS
+ }
+
+ if ctx.Config.SmartypantsQuotesNBSP {
+ htmlFlags |= blackfriday.HTML_SMARTYPANTS_QUOTES_NBSP
}
if ctx.Config.AngledQuotes {
--- a/helpers/content_test.go
+++ b/helpers/content_test.go
@@ -171,6 +171,7 @@
{blackfriday.HTML_USE_XHTML},
{blackfriday.HTML_FOOTNOTE_RETURN_LINKS},
{blackfriday.HTML_USE_SMARTYPANTS},
+ {blackfriday.HTML_SMARTYPANTS_QUOTES_NBSP},
{blackfriday.HTML_SMARTYPANTS_ANGLED_QUOTES},
{blackfriday.HTML_SMARTYPANTS_FRACTIONS},
{blackfriday.HTML_HREF_TARGET_BLANK},
@@ -186,6 +187,7 @@
ctx.Config.PlainIDAnchors = true
ctx.Config.SmartDashes = true
ctx.Config.Smartypants = true
+ ctx.Config.SmartypantsQuotesNBSP = true
ctx.Config.SourceRelativeLinksEval = true
renderer := c.getHTMLRenderer(defaultFlags, ctx)
actualFlags := renderer.GetFlags()