1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-25 21:39:02 +02:00

Don't append semicolon to styleEntry if there is no other style

This means we also need to append semicolon to `Background`.
This commit is contained in:
Siavash Askari Nasr 2022-06-14 09:02:22 +04:30 committed by Alec Thomas
parent 5397b4880b
commit 530c45d213

View File

@ -467,12 +467,12 @@ func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string
}
styleEntryCSS := StyleEntryToCSS(entry)
if styleEntryCSS != `` {
if styleEntryCSS != `` && classes[t] != `` {
styleEntryCSS += `;`
}
classes[t] = styleEntryCSS + classes[t]
}
classes[chroma.Background] += f.tabWidthStyle()
classes[chroma.Background] += `;` + f.tabWidthStyle()
classes[chroma.PreWrapper] += classes[chroma.Background]
// Make PreWrapper a grid to show highlight style with full width.
if len(f.highlightRanges) > 0 && f.customCSS[chroma.PreWrapper] == `` {