Add blackfriday/ExtensionsMask option.

This commit is contained in:
Yosuke INOUE 2015-04-16 10:54:10 +09:00 committed by bep
parent ee5a1bbf44
commit 3596b1b810
2 changed files with 16 additions and 0 deletions

View 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>

View 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
}