From 3596b1b81078c1089d6b294a9b35954741d878a9 Mon Sep 17 00:00:00 2001 From: Yosuke INOUE Date: Thu, 16 Apr 2015 10:54:10 +0900 Subject: [PATCH] Add blackfriday/ExtensionsMask option. --- docs/content/overview/configuration.md | 10 ++++++++++ helpers/content.go | 6 ++++++ 2 files changed, 16 insertions(+) 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 } -- 2.30.2