remove newline at the end of codeblocks

This commit is contained in:
ston1th 2019-08-04 22:00:43 +02:00
commit 94762c62e4

View file

@ -33,9 +33,10 @@ var (
func Render(p *core.Page) string {
rend := blackfriday.MarkdownCommon([]byte(p.Markdown))
toc, html := buildTOC(string(rend))
html = strings.Replace(html, "<table>", `<table class="table">`, -1)
html = strings.Replace(html, "</h1>", `</h1><hr>`, -1)
html = strings.Replace(html, "<a", `<a target="_blank" rel="noopener noreferrer"`, -1)
html = strings.ReplaceAll(html, "<table>", `<table class="table">`)
html = strings.ReplaceAll(html, "</h1>", `</h1><hr>`)
html = strings.ReplaceAll(html, "<a", `<a target="_blank" rel="noopener noreferrer"`)
html = strings.ReplaceAll(html, "\n</code", "</code")
p.TOC = template.HTML(toc)
p.HTML = template.HTML(html)
return whiteSpace.ReplaceAllString(string(filter.Filter(rend)), " ")
@ -128,7 +129,7 @@ func closeTag(j int) (ret string) {
ret += "</li></ul></li>"
}
if j > 1 {
ret = strings.Replace(ret, "</li></li>", "</li>", -1)
ret = strings.ReplaceAll(ret, "</li></li>", "</li>")
}
return
}