Add config options: disable footnote anchor prefix and header ID suffix
authorJacob Gillespie <jacobwgillespie@gmail.com>
Sun, 4 Jan 2015 17:27:09 +0000 (11:27 -0600)
committerbep <bjorn.erik.pedersen@gmail.com>
Mon, 5 Jan 2015 20:00:22 +0000 (21:00 +0100)
New config options:

* DisableFootnoteAnchorPrefix - bool - default: false
* DisableHeaderIDSuffix - bool - default: false

commands/hugo.go
helpers/content.go

index ca7caf090ec40a18c1eb29555d0ab933df2a077c..6cb153e1bc73db6be2c1f4c4897a8b306abeaa71 100644 (file)
@@ -123,6 +123,8 @@ func InitializeConfig() {
        viper.SetDefault("BuildDrafts", false)
        viper.SetDefault("BuildFuture", false)
        viper.SetDefault("UglyUrls", false)
+       viper.SetDefault("DisableFootnoteAnchorPrefix", false)
+       viper.SetDefault("DisableHeaderIDSuffix", false)
        viper.SetDefault("Verbose", false)
        viper.SetDefault("CanonifyUrls", false)
        viper.SetDefault("Indexes", map[string]string{"tag": "tags", "category": "categories"})
index 5d4e800584f04a8e5c0e83e82e71d906a5b42abd..baccc8574efadbe78928b98df49b9a5d61f304e4 100644 (file)
@@ -85,8 +85,11 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
                FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
        }
 
-       if len(ctx.DocumentId) != 0 {
+       if len(ctx.DocumentId) != 0 && !viper.GetBool("DisableFootnoteAnchorPrefix") {
                renderParameters.FootnoteAnchorPrefix = ctx.DocumentId + ":" + renderParameters.FootnoteAnchorPrefix
+       }
+
+       if len(ctx.DocumentId) != 0 && !viper.GetBool("DisableHeaderIDSuffix") {
                renderParameters.HeaderIDSuffix = ":" + ctx.DocumentId
        }