mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 20:33:59 +02:00
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:
@@ -202,7 +202,7 @@ func highlight(fw hugio.FlexiWriter, code, lang string, attributes []attributes.
|
||||
}
|
||||
|
||||
if !cfg.Hl_inline {
|
||||
writeDivStart(w, attributes)
|
||||
writeDivStart(w, attributes, cfg.WrapperClass)
|
||||
}
|
||||
|
||||
options := cfg.toHTMLOptions()
|
||||
@@ -303,8 +303,9 @@ func (s startEnd) End(code bool) string {
|
||||
return s.end(code)
|
||||
}
|
||||
|
||||
func writeDivStart(w hugio.FlexiWriter, attrs []attributes.Attribute) {
|
||||
w.WriteString(`<div class="highlight`)
|
||||
func writeDivStart(w hugio.FlexiWriter, attrs []attributes.Attribute, wrapperClass string) {
|
||||
w.WriteString(`<div class="`)
|
||||
w.WriteString(wrapperClass)
|
||||
if attrs != nil {
|
||||
for _, attr := range attrs {
|
||||
if attr.Name == "class" {
|
||||
|
Reference in New Issue
Block a user