working on gfm compat (helps #1224) (#1342)

* fix gfm compat

Signed-off-by: Kirill Danshin <k@guava.by>

* fix .travis.yml

Signed-off-by: Kirill Danshin <k@guava.by>

* requested changes

Signed-off-by: Kirill Danshin <k@guava.by>
This commit is contained in:
Kirill Danshin 2017-04-27 17:08:18 +03:00 committed by Thiago Avelino
parent 7f3a74f4b6
commit 8a0043468c
2 changed files with 3 additions and 38 deletions

View File

@ -6,7 +6,4 @@ go:
sudo: false sudo: false
install: install:
- go get github.com/russross/blackfriday - go get -t -v ./...
- go get github.com/PuerkitoBio/goquery
- go get github.com/gorilla/mux
- go get github.com/microcosm-cc/bluemonday

36
repo.go
View File

@ -8,8 +8,7 @@ import (
"text/template" "text/template"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/microcosm-cc/bluemonday" gfm "github.com/shurcooL/github_flavored_markdown"
"github.com/russross/blackfriday"
) )
// memory usage optimizations // memory usage optimizations
@ -24,25 +23,6 @@ const (
readmePath = "./README.md" readmePath = "./README.md"
tplPath = "tmpl/tmpl.html" tplPath = "tmpl/tmpl.html"
idxPath = "tmpl/index.html" idxPath = "tmpl/index.html"
bfHTMLRendererOpts = 0 |
blackfriday.HTML_USE_XHTML |
blackfriday.HTML_USE_SMARTYPANTS |
blackfriday.HTML_SMARTYPANTS_FRACTIONS |
blackfriday.HTML_SMARTYPANTS_DASHES |
blackfriday.HTML_SMARTYPANTS_LATEX_DASHES
bfMDOpts = 0 |
blackfriday.EXTENSION_NO_INTRA_EMPHASIS |
blackfriday.EXTENSION_TABLES |
blackfriday.EXTENSION_FENCED_CODE |
blackfriday.EXTENSION_AUTOLINK |
blackfriday.EXTENSION_STRIKETHROUGH |
blackfriday.EXTENSION_SPACE_HEADERS |
blackfriday.EXTENSION_HEADER_IDS |
blackfriday.EXTENSION_BACKSLASH_LINE_BREAK |
blackfriday.EXTENSION_DEFINITION_LISTS |
blackfriday.EXTENSION_AUTO_HEADER_IDS
) )
var ( var (
@ -59,19 +39,7 @@ func generateHTML() {
exec.Command(git, pull).Output() exec.Command(git, pull).Output()
input, _ := ioutil.ReadFile(readmePath) input, _ := ioutil.ReadFile(readmePath)
body := string( body := string(gfm.Markdown(input))
bluemonday.UGCPolicy().SanitizeBytes(
blackfriday.Markdown(
input,
blackfriday.HtmlRenderer(
bfHTMLRendererOpts,
emtyStr,
emtyStr,
),
bfMDOpts,
),
),
)
c := &content{Body: body} c := &content{Body: body}
t := template.Must(template.ParseFiles(tplPath)) t := template.Must(template.ParseFiles(tplPath))