From 8e810cc9d2edd7e29e7d7b62a79f8f39109cc4a4 Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 13 May 2018 14:13:37 -0500 Subject: [PATCH] revert bfchroma md render, need some sanitizer exceptions --- app/rest/api/rest.go | 7 +++---- app/rest/api/rest_test.go | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/rest/api/rest.go b/app/rest/api/rest.go index 87f95bb5..06d2d2e6 100644 --- a/app/rest/api/rest.go +++ b/app/rest/api/rest.go @@ -12,7 +12,6 @@ import ( "strings" "time" - "github.com/Depado/bfchroma" "github.com/didip/tollbooth" "github.com/didip/tollbooth_chi" "github.com/go-chi/chi" @@ -184,9 +183,9 @@ func (s *Rest) previewCommentCtrl(w http.ResponseWriter, r *http.Request) { return } - comment.Text = string(blackfriday.Run([]byte(comment.Text), - blackfriday.WithRenderer(bfchroma.NewRenderer(bfchroma.WithoutAutodetect())))) - //comment.Text = string(blackfriday.Run([]byte(comment.Text), blackfriday.WithExtensions(mdExt))) + //comment.Text = string(blackfriday.Run([]byte(comment.Text), + // blackfriday.WithRenderer(bfchroma.NewRenderer(bfchroma.WithoutAutodetect())))) + comment.Text = string(blackfriday.Run([]byte(comment.Text), blackfriday.WithExtensions(mdExt))) comment.Sanitize() render.HTML(w, r, comment.Text) } diff --git a/app/rest/api/rest_test.go b/app/rest/api/rest_test.go index fe50d129..38d2d939 100644 --- a/app/rest/api/rest_test.go +++ b/app/rest/api/rest_test.go @@ -91,7 +91,7 @@ func TestServer_Preview(t *testing.T) { assert.Equal(t, "

test 123

\n", string(b)) } -func _TestServer_PreviewWithMD(t *testing.T) { +func TestServer_PreviewWithMD(t *testing.T) { srv, port := prep(t) require.NotNil(t, srv) defer cleanup(srv)