Add blackfriday/ExtensionsMask option.
authorYosuke INOUE <inoue@kamikakushi.net>
Thu, 16 Apr 2015 01:54:10 +0000 (10:54 +0900)
committerbep <bjorn.erik.pedersen@gmail.com>
Thu, 7 May 2015 19:12:28 +0000 (21:12 +0200)
docs/content/overview/configuration.md
helpers/content.go

index ce9107a8c1b62a2e3dbc9952318b8cbb87d253fb..6e1be3bfa7a1a7d40f2f18580638a37b59487f53 100644 (file)
@@ -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>
 
index daf7e267da4b45be00a11bd82e4043fe166bdb79..a5f2a5608c0e53548af732781fb13a0776681136 100644 (file)
@@ -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
 }