func TestRenderHooksDefaultEscape(t *testing.T) {
files := `
-- hugo.toml --
-[markup.goldmark.renderHooks]
+[markup.goldmark.extensions.typographer]
+disable = true
[markup.goldmark.renderHooks.image]
- enableDefault = ENABLE
+enableDefault = ENABLE
[markup.goldmark.renderHooks.link]
enableDefault = ENABLE
[markup.goldmark.parser]
[markup.goldmark.parser.attribute]
block = true
title = true
+
-- content/_index.md --
---
title: "Home"
if enabled {
b.AssertFileContent("public/index.html",
"Link: <a href=\"/destination-%22%3C%3E\" title=\"title-"<>&\">text-"<>&</a>",
- "img src=\"/destination-%22%3C%3E\" alt=\"alt-"<>&\" title=\"title-"<>&\">",
+ "img src=\"/destination-%22%3C%3E\" alt=\"alt-"<>&\" title=\"title-"<>&\">",
"><script>",
)
} else {
-- config.toml --
baseURL = 'https://example.org/dir/'
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
+[markup.goldmark.extensions.typographer]
+disable = true
[markup.goldmark.parser]
wrapStandAloneImageWithinParagraph = false
[markup.goldmark.parser.attribute]
b.AssertFileContent("public/p1/index.html",
`<img src="" alt="">`,
`<img src="/dir/p1/pixel.png" alt="alt1">`,
- `<img src="/dir/p1/pixel.png" alt="alt2-&<>’" title="&<>'">`,
+ `<img src="/dir/p1/pixel.png" alt="alt2-&<>'" title="&<>'">`,
`<img src="/dir/p1/pixel.png?a=b&c=d#fragment" alt="alt3">`,
`<img src="/dir/p1/pixel.png" alt="alt4">`,
)
b.AssertFileContent("public/p1/index.html",
`<img src="" alt="">`,
`<img src="/dir/p1/pixel.png" alt="alt1">`,
- `<img src="/dir/p1/pixel.png" alt="alt2-&<>’" title="&<>'">`,
+ `<img src="/dir/p1/pixel.png" alt="alt2-&<>'" title="&<>'">`,
`<img src="/dir/p1/pixel.png?a=b&c=d#fragment" alt="alt3" class="foo" id="bar">`,
`<img src="/dir/p1/pixel.png" alt="alt4" id=""><script>alert()</script>">`,
)