gopherproxy/markdown.go

18 lines
341 B
Go
Raw Permalink Normal View History

2018-10-07 22:48:10 +00:00
package gopherproxy
import (
"bytes"
"html/template"
"io"
"strings"
2018-10-07 22:48:10 +00:00
"github.com/gomarkdown/markdown"
)
func renderMd(b io.Reader) template.HTML {
buf := new(bytes.Buffer)
buf.ReadFrom(b)
md := string(markdown.ToHTML(buf.Bytes(), nil, nil))
return template.HTML(strings.Replace(md, "<img", "<img class=\"img-responsive\"", -1))
2018-10-07 22:48:10 +00:00
}