sanitize markdown

This commit is contained in:
Kirill Danshin 2017-01-19 18:31:17 +03:00
parent bc3434bb6a
commit 7cee227b4a

17
repo.go
View File

@ -8,6 +8,7 @@ import (
"text/template" "text/template"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/microcosm-cc/bluemonday"
"github.com/russross/blackfriday" "github.com/russross/blackfriday"
) )
@ -59,14 +60,16 @@ func generateHTML() {
input, _ := ioutil.ReadFile(readmePath) input, _ := ioutil.ReadFile(readmePath)
body := string( body := string(
blackfriday.Markdown( bluemonday.UGCPolicy().SanitizeBytes(
input, blackfriday.Markdown(
blackfriday.HtmlRenderer( input,
bfHTMLRendererOpts, blackfriday.HtmlRenderer(
emtyStr, bfHTMLRendererOpts,
emtyStr, emtyStr,
emtyStr,
),
bfMDOpts,
), ),
bfMDOpts,
), ),
) )
c := &content{Body: body} c := &content{Body: body}