mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
HTML5 doctype, Wrap TOC with <nav>
<nav> makes the TOC more easily identifiable and workable with CSS.
This commit is contained in:
parent
b3c6494605
commit
8a86b6d6be
7
html.go
7
html.go
|
@ -530,8 +530,7 @@ func (options *Html) DocumentHeader(out *bytes.Buffer) {
|
||||||
out.WriteString("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n")
|
out.WriteString("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n")
|
||||||
ending = " /"
|
ending = " /"
|
||||||
} else {
|
} else {
|
||||||
out.WriteString("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" ")
|
out.WriteString("<!DOCTYPE html>\n")
|
||||||
out.WriteString("\"http://www.w3.org/TR/html4/strict.dtd\">\n")
|
|
||||||
out.WriteString("<html>\n")
|
out.WriteString("<html>\n")
|
||||||
}
|
}
|
||||||
out.WriteString("<head>\n")
|
out.WriteString("<head>\n")
|
||||||
|
@ -543,7 +542,7 @@ func (options *Html) DocumentHeader(out *bytes.Buffer) {
|
||||||
out.WriteString("\"")
|
out.WriteString("\"")
|
||||||
out.WriteString(ending)
|
out.WriteString(ending)
|
||||||
out.WriteString(">\n")
|
out.WriteString(">\n")
|
||||||
out.WriteString(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"")
|
out.WriteString(" <meta charset=\"utf-8\"")
|
||||||
out.WriteString(ending)
|
out.WriteString(ending)
|
||||||
out.WriteString(">\n")
|
out.WriteString(">\n")
|
||||||
if options.css != "" {
|
if options.css != "" {
|
||||||
|
@ -579,7 +578,9 @@ func (options *Html) DocumentFooter(out *bytes.Buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert the table of contents
|
// insert the table of contents
|
||||||
|
out.WriteString("<nav>\n")
|
||||||
out.Write(options.toc.Bytes())
|
out.Write(options.toc.Bytes())
|
||||||
|
out.WriteString("</nav>\n")
|
||||||
|
|
||||||
// corner case spacing issue
|
// corner case spacing issue
|
||||||
if options.flags&HTML_COMPLETE_PAGE == 0 && options.flags&HTML_OMIT_CONTENTS == 0 {
|
if options.flags&HTML_COMPLETE_PAGE == 0 && options.flags&HTML_OMIT_CONTENTS == 0 {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user