From: Yosuke INOUE Date: Thu, 16 Apr 2015 01:54:10 +0000 (+0900) Subject: Add blackfriday/ExtensionsMask option. X-Git-Tag: v0.14~83 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3596b1b8;p=brevno-suite%2Fhugo Add blackfriday/ExtensionsMask option. --- diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md index ce9107a8..6e1be3bf 100644 --- a/docs/content/overview/configuration.md +++ b/docs/content/overview/configuration.md @@ -198,6 +198,16 @@ but only these three. Purpose: Use non-default additional extensions (e.g. Add "hardLineBreak" to use EXTENSION_HARD_LINE_BREAK) + + +extensionsmask +[] +EXTENSION_* + + +Purpose: +Extensions in this option won't be loaded. (e.g. Add "autoHeaderIds" to disable EXTENSION_AUTO_HEADER_IDS) + diff --git a/helpers/content.go b/helpers/content.go index daf7e267..a5f2a560 100644 --- 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 }