mirror of
https://github.com/httpjamesm/AnonymousOverflow.git
synced 2025-04-20 13:59:16 +00:00
fix: constrain greedy code block match
This commit is contained in:
parent
066a3fdaff
commit
f7ae1a623c
1 changed files with 1 additions and 1 deletions
|
@ -73,7 +73,7 @@ func stripBlockTags(content string) (result string) {
|
||||||
return
|
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.
|
// HighlightCodeBlocks uses both highlightSyntaxViaContent stripCodeBlocks and returns the newly highlighted code HTML.
|
||||||
func HighlightCodeBlocks(html string) string {
|
func HighlightCodeBlocks(html string) string {
|
||||||
|
|
Loading…
Add table
Reference in a new issue