Skip to content

Commit

Permalink
Fix #155 by skipping empty <h1></h1> tags
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Dec 9, 2024
1 parent f16db3f commit 327a397
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions themes/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,19 @@ func MessagePageBytes(title string, body []byte, theme string) []byte {
// SimpleHTMLPage provides a quick way to build a HTML page
func SimpleHTMLPage(title, headline, inhead, body []byte) []byte {
var buf bytes.Buffer
buf.WriteString("<!doctype html><html><head><title>")
buf.Write(title)
buf.WriteString("</title>")
buf.WriteString("<!doctype html><html>")
if len(title) > 0 {
buf.WriteString("<head><title>")
buf.Write(title)
buf.WriteString("</title></head>")
}
buf.Write(inhead)
buf.WriteString("</head><body><h1>")
buf.Write(headline)
buf.WriteString("</h1>")
buf.WriteString("<body>")
if len(headline) > 0 {
buf.WriteString("<h1>")
buf.Write(headline)
buf.WriteString("</h1>")
}
buf.Write(body)
return buf.Bytes()
}
Expand Down

0 comments on commit 327a397

Please sign in to comment.