Rename to plainIdAnchors - hugo - [fork] hugo port for 9front
(HTM) git clone git@git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit c0f54aefe38bc16406a187b3d20b6ffddc70eb04
(DIR) parent a0e44bb71ddb49816511a40fc97ed66aa021d450
(HTM) Author: Jacob Gillespie <jacobwgillespie@gmail.com>
Date: Mon, 5 Jan 2015 13:00:56 -0600
Rename to plainIdAnchors
Diffstat:
M commands/hugo.go | 2 +-
M docs/content/overview/configuratio… | 4 ++--
M helpers/content.go | 4 +++-
3 files changed, 6 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/commands/hugo.go b/commands/hugo.go
@@ -136,7 +136,7 @@ func InitializeConfig() {
viper.SetDefault("FootnoteAnchorPrefix", "")
viper.SetDefault("FootnoteReturnLinkContents", "")
viper.SetDefault("NewContentEditor", "")
- viper.SetDefault("Blackfriday", map[string]bool{"angledQuotes": false, "documentIDAnchor": true})
+ viper.SetDefault("Blackfriday", map[string]bool{"angledQuotes": false, "plainIdAnchors": false})
if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
viper.Set("BuildDrafts", Draft)
(DIR) diff --git a/docs/content/overview/configuration.md b/docs/content/overview/configuration.md
@@ -77,14 +77,14 @@ But Hugo does expose some options -- in the table below matched with the corresp
Flag | Default | Blackfriday flag | Purpose
--- | --- | --- | ---
angledQuotes | false | HTML_SMARTYPANTS_ANGLED_QUOTES | Enable angled double quotes (`« »`)
-documentIDAnchor | true | FootnoteAnchorPrefix and HeaderIDSuffix | Enable the prepending / appending of the unique document ID to the footnote and header anchor IDs
+plainIdAnchors | false | FootnoteAnchorPrefix and HeaderIDSuffix | If true, then header and footnote IDs are generated without the document ID (so, `#my-header` instead of `#my-header:bec3ed8ba720b9073ab75abcf3ba5d97`)
**Note** that these flags must be grouped under the `blackfriday` key and can be set on **both site and page level**. If set on page, it will override the site setting.
```
blackfriday:
angledQuotes = true
- documentIDAnchor = false
+ plainIdAnchors = true
```
## Notes
(DIR) diff --git a/helpers/content.go b/helpers/content.go
@@ -85,7 +85,9 @@ func GetHtmlRenderer(defaultFlags int, ctx RenderingContext) blackfriday.Rendere
FootnoteReturnLinkContents: viper.GetString("FootnoteReturnLinkContents"),
}
- if m, ok := ctx.ConfigFlags["documentIDAnchor"]; ok && m && len(ctx.DocumentId) != 0 {
+ b := len(ctx.DocumentId) != 0
+
+ if m, ok := ctx.ConfigFlags["plainIdAnchors"]; b && ((ok && !m) || !ok) {
renderParameters.FootnoteAnchorPrefix = ctx.DocumentId + ":" + renderParameters.FootnoteAnchorPrefix
renderParameters.HeaderIDSuffix = ":" + ctx.DocumentId
}