fix: escape code blocks to prevent HTML injection
This commit is contained in:
parent
8f9091fb2a
commit
5bd9ce484f
@ -1,3 +1,3 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
var Version = "1.2"
|
var Version = "1.2.1"
|
||||||
|
@ -17,7 +17,7 @@ var plainFormattedCodeRegex = regexp.MustCompile(`(?s)<pre tabindex="0" class="c
|
|||||||
func HighlightSyntaxViaContent(content string) (htmlOut string) {
|
func HighlightSyntaxViaContent(content string) (htmlOut string) {
|
||||||
content = html.UnescapeString(content)
|
content = html.UnescapeString(content)
|
||||||
|
|
||||||
fallbackOut := content
|
fallbackOut := html.EscapeString(content)
|
||||||
|
|
||||||
// identify the language
|
// identify the language
|
||||||
lexer := lexers.Analyse(content)
|
lexer := lexers.Analyse(content)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user