From: Jacob Gillespie Date: Sun, 4 Jan 2015 17:27:09 +0000 (-0600) Subject: Add config options: disable footnote anchor prefix and header ID suffix X-Git-Tag: v0.13~214 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b7716948;p=brevno-suite%2Fhugo Add config options: disable footnote anchor prefix and header ID suffix New config options: * DisableFootnoteAnchorPrefix - bool - default: false * DisableHeaderIDSuffix - bool - default: false --- diff --git a/commands/hugo.go b/commands/hugo.go index ca7caf09..6cb153e1 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -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"}) diff --git a/helpers/content.go b/helpers/content.go index 5d4e8005..baccc857 100644 --- a/helpers/content.go +++ b/helpers/content.go @@ -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 }