hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 3596b1b81078c1089d6b294a9b35954741d878a9
parent ee5a1bbf44726d062c623d3ed2772d22d562203f
Author: Yosuke INOUE <inoue@kamikakushi.net>
Date:   Thu, 16 Apr 2015 10:54:10 +0900

Add blackfriday/ExtensionsMask option.

Diffstat:
Mdocs/content/overview/configuration.md | 10++++++++++
Mhelpers/content.go | 6++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md
@@ -198,6 +198,16 @@ but only these three.</small></td>
 <td class="purpose-title">Purpose:</td>
 <td class="purpose-description" colspan="2">Use non-default additional extensions <small>(e.g.&nbsp;Add <code>"hardLineBreak"</code> to use <code>EXTENSION_HARD_LINE_BREAK</code>)</small></td>
 </tr>
+
+<tr>
+<td><code>extensionsmask</code></td>
+<td><code>[]</code></td>
+<td><code>EXTENSION_*</code></td>
+</tr>
+<tr>
+<td class="purpose-title">Purpose:</td>
+<td class="purpose-description" colspan="2">Extensions in this option won't be loaded. <small>(e.g.&nbsp;Add <code>"autoHeaderIds"</code> to disable <code>EXTENSION_AUTO_HEADER_IDS</code>)</small></td>
+</tr>
 </tbody>
 </table>
 
diff --git a/helpers/content.go b/helpers/content.go
@@ -43,6 +43,7 @@ type Blackfriday struct {
 	Fractions      bool
 	PlainIDAnchors bool
 	Extensions     []string
+	ExtensionsMask []string
 }
 
 // NewBlackfriday creates a new Blackfriday with some sane defaults.
@@ -154,6 +155,11 @@ func getMarkdownExtensions(ctx *RenderingContext) int {
 			flags |= flag
 		}
 	}
+	for _, extension := range ctx.getConfig().ExtensionsMask {
+		if flag, ok := blackfridayExtensionMap[extension]; ok {
+			flags &= ^flag
+		}
+	}
 	return flags
 }