parent
f1e799c2e1
commit
494e88abf6
2 changed files with 26 additions and 4 deletions
|
@ -499,10 +499,10 @@ func (r *hookedRenderer) renderHeading(w util.BufWriter, source []byte, node ast
|
||||||
|
|
||||||
text := ctx.PopRenderedString()
|
text := ctx.PopRenderedString()
|
||||||
|
|
||||||
// All ast.Heading nodes are guaranteed to have an attribute called "id"
|
var anchor []byte
|
||||||
// that is an array of bytes that encode a valid string.
|
if anchori, ok := n.AttributeString("id"); ok {
|
||||||
anchori, _ := n.AttributeString("id")
|
anchor, _ = anchori.([]byte)
|
||||||
anchor := anchori.([]byte)
|
}
|
||||||
|
|
||||||
page, pageInner := render.GetPageAndPageInner(ctx)
|
page, pageInner := render.GetPageAndPageInner(ctx)
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,29 @@ title: p7 (emoji)
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// emoji
|
// emoji
|
||||||
|
|
||||||
b.AssertFileContent("public/p7/index.html", `
|
b.AssertFileContent("public/p7/index.html", `
|
||||||
<li><a href="#a-snake-emoji">A 🐍 emoji</a></li>
|
<li><a href="#a-snake-emoji">A 🐍 emoji</a></li>
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue13416(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
|
||||||
|
-- layouts/index.html --
|
||||||
|
Content:{{ .Content }}|
|
||||||
|
-- layouts/_default/_markup/render-heading.html --
|
||||||
|
-- content/_index.md --
|
||||||
|
---
|
||||||
|
title: home
|
||||||
|
---
|
||||||
|
#
|
||||||
|
`
|
||||||
|
|
||||||
|
b := hugolib.Test(t, files)
|
||||||
|
|
||||||
|
b.AssertFileExists("public/index.html", true)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue