diff --git a/html.go b/html.go index 5e56b83..f1a60de 100644 --- a/html.go +++ b/html.go @@ -831,7 +831,7 @@ func (r *HTMLRenderer) RenderFooter(w io.Writer, ast *Node) { if r.Flags&CompletePage == 0 { return } - w.Write([]byte("\n\n\n")) + io.WriteString(w, "\n\n\n") } func (r *HTMLRenderer) writeDocumentHeader(w io.Writer) { @@ -840,46 +840,46 @@ func (r *HTMLRenderer) writeDocumentHeader(w io.Writer) { } ending := "" if r.Flags&UseXHTML != 0 { - w.Write([]byte("\n")) - w.Write([]byte("\n")) + io.WriteString(w, "\n") + io.WriteString(w, "\n") ending = " /" } else { - w.Write([]byte("\n")) - w.Write([]byte("\n")) + io.WriteString(w, "\n") + io.WriteString(w, "\n") } - w.Write([]byte("\n")) - w.Write([]byte(" ")) + io.WriteString(w, "<head>\n") + io.WriteString(w, " <title>") if r.Flags&Smartypants != 0 { r.sr.Process(w, []byte(r.Title)) } else { escapeHTML(w, []byte(r.Title)) } - w.Write([]byte("\n")) - w.Write([]byte(" \n")) - w.Write([]byte(" \n")) + io.WriteString(w, "\n") + io.WriteString(w, " \n") + io.WriteString(w, " \n") if r.CSS != "" { - w.Write([]byte(" \n")) + io.WriteString(w, "\"") + io.WriteString(w, ending) + io.WriteString(w, ">\n") } if r.Icon != "" { - w.Write([]byte(" \n")) + io.WriteString(w, "\"") + io.WriteString(w, ending) + io.WriteString(w, ">\n") } - w.Write([]byte("\n")) - w.Write([]byte("\n\n")) + io.WriteString(w, "\n") + io.WriteString(w, "\n\n") } func (r *HTMLRenderer) writeTOC(w io.Writer, ast *Node) { @@ -895,24 +895,24 @@ func (r *HTMLRenderer) writeTOC(w io.Writer, ast *Node) { if entering { node.HeadingID = fmt.Sprintf("toc_%d", headingCount) if node.Level == tocLevel { - buf.Write([]byte("\n\n
  • ")) + buf.WriteString("
  • \n\n
  • ") } else if node.Level < tocLevel { for node.Level < tocLevel { tocLevel-- - buf.Write([]byte("
  • \n")) + buf.WriteString("\n") } - buf.Write([]byte("\n\n
  • ")) + buf.WriteString("
  • \n\n
  • ") } else { for node.Level > tocLevel { tocLevel++ - buf.Write([]byte("\n") } if buf.Len() > 0 { - w.Write([]byte("\n") } r.lastOutputLen = buf.Len() }