Add Icon parameter to the HTML renderer

This commit is contained in:
Pierre Neidhardt 2016-08-09 17:54:34 +05:30
parent 0f3eafddfa
commit 413328d30b

View File

@ -83,6 +83,7 @@ type HTMLRendererParameters 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)
Flags HTMLFlags // Flags allow customizing this renderer's behavior
Extensions Extensions // Extensions give Smartypants and HTML renderer access to Blackfriday's global extensions
@ -741,6 +742,13 @@ func (r *HTMLRenderer) writeDocumentHeader(w *bytes.Buffer, sr *SPRenderer) {
w.WriteString(ending)
w.WriteString(">\n")
}
if r.Icon != "" {
w.WriteString(" <link rel=\"icon\" type=\"image/x-icon\" href=\"")
w.Write(esc([]byte(r.Icon)))
w.WriteString("\"")
w.WriteString(ending)
w.WriteString(">\n")
}
w.WriteString("</head>\n")
w.WriteString("<body>\n\n")
}