mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Add blackfriday/ExtensionsMask option.
This commit is contained in:
parent
ee5a1bbf44
commit
3596b1b810
2 changed files with 16 additions and 0 deletions
|
@ -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. 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. Add <code>"autoHeaderIds"</code> to disable <code>EXTENSION_AUTO_HEADER_IDS</code>)</small></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue