fix: don't require snippet lang classes in code blocks

This commit is contained in:
Solomon Victorino 2024-03-21 23:37:46 -06:00
parent 0b073c0d3c
commit 066a3fdaff

View file

@ -73,7 +73,7 @@ func stripBlockTags(content string) (result string) {
return
}
var codeBlockRegex = regexp.MustCompile(`(?s)<pre.*?lang-(.*?)[\s"'].*?><code>(.*?)<\/code><\/pre>`)
var codeBlockRegex = regexp.MustCompile(`(?s)<pre(?:.+?lang-(.+?)[\s"'])?.*?><code>(.*?)<\/code><\/pre>`)
// HighlightCodeBlocks uses both highlightSyntaxViaContent stripCodeBlocks and returns the newly highlighted code HTML.
func HighlightCodeBlocks(html string) string {