markup/highlight: Add wrapperClass option

The need comes from Tailwind's typography plugin. There's currently no way to turn that off outside of the markup, see https://github.com/tailwindlabs/tailwindcss-typography/pull/363
This commit is contained in:
Bjørn Erik Pedersen
2024-12-25 18:20:16 +01:00
parent 845b8885de
commit ec0caaec7c
3 changed files with 35 additions and 3 deletions

View File

@@ -103,3 +103,29 @@ xəx := 0
<span class="nx">xəx</span>
`)
}
func TestHighlightClass(t *testing.T) {
t.Parallel()
files := `
-- config.toml --
[markup.highlight]
noClasses = false
wrapperClass = "highlight no-prose"
-- content/_index.md --
---
title: home
---
§§§go
xəx := 0
§§§
-- layouts/index.html --
{{ .Content }}
`
b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", `
<div class="highlight no-prose"><pre
`)
}