Skip to content

Commit

Permalink
🎨 Add switch X-CodeSyntaxHighlight
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 2, 2024
1 parent e6c12aa commit ece0a2c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ func handleTextBundle(ctx *fasthttp.RequestCtx) {
func handleMarkdown2HTML(ctx *fasthttp.RequestCtx) {
body := ctx.PostBody()
engine := newLute()

CodeSyntaxHighlight := string(ctx.Request.Header.Peek("X-CodeSyntaxHighlight"))
if "true" == CodeSyntaxHighlight {
engine.SetCodeSyntaxHighlight(true)
} else if "false" == CodeSyntaxHighlight {
engine.SetCodeSyntaxHighlight(false)
}

CodeSyntaxHighlightLineNum := string(ctx.Request.Header.Peek("X-CodeSyntaxHighlightLineNum"))
if "true" == CodeSyntaxHighlightLineNum {
engine.SetCodeSyntaxHighlightLineNum(true)
Expand Down

0 comments on commit ece0a2c

Please sign in to comment.