Files

21 lines
496 B
Go
Raw Permalink Normal View History

2026-05-31 02:28:48 +00:00
package markdown
import (
"bytes"
"html"
)
2026-05-31 02:28:48 +00:00
func wrapHTML(body []byte, cssHref string) []byte {
2026-05-31 02:28:48 +00:00
var buf bytes.Buffer
buf.WriteString("<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n")
if cssHref != "" {
buf.WriteString("<link rel=\"stylesheet\" href=\"")
buf.WriteString(html.EscapeString(cssHref))
buf.WriteString("\">\n")
}
buf.WriteString("<title></title>\n</head>\n<body>\n")
2026-05-31 02:28:48 +00:00
buf.Write(body)
buf.WriteString("</body>\n</html>\n")
return buf.Bytes()
}