Merge pull request #51 from mmarkdown/include-head-bytes

html: Allow additional head bytes to be injected
This commit is contained in:
Miek Gieben 2018-08-12 21:22:11 +01:00 committed by GitHub
commit 560804f06c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,7 @@ type RendererOptions struct {
Title string // Document title (used if CompletePage is set)
CSS string // Optional CSS file URL (used if CompletePage is set)
Icon string // Optional icon file URL (used if CompletePage is set)
Head []byte // Optional head data injected in the <head> section (used if CompletePage is set)
Flags Flags // Flags allow customizing this renderer's behavior
@ -1025,6 +1026,9 @@ func (r *Renderer) writeDocumentHeader(w io.Writer) {
io.WriteString(w, ending)
io.WriteString(w, ">\n")
}
if r.opts.Head != nil {
w.Write(r.opts.Head)
}
io.WriteString(w, "</head>\n")
io.WriteString(w, "<body>\n\n")
}