diff --git a/README.md b/README.md index 5c58bb0..c975351 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ All additional filters/tags will be registered automatically. - **truncatesentences** / **truncatesentences_html** (returns the first X sentences [like truncatechars/truncatewords]; please provide X as a parameter) - Markup - - **markdown** (parses markdown text and outputs HTML; **hint**: use the **safe**-filter to make the output not being escaped) + - **markdown** - Humanize - **[intcomma](https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#intcomma)** (put decimal marks into the number) diff --git a/filters.go b/filters.go index e7e0a9b..d08e934 100644 --- a/filters.go +++ b/filters.go @@ -36,7 +36,7 @@ func init() { } func filterMarkdown(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, error) { - return pongo2.AsValue(string(blackfriday.MarkdownCommon([]byte(in.String())))), nil + return pongo2.AsSafeValue(string(blackfriday.MarkdownCommon([]byte(in.String())))), nil } func filterSlugify(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, error) { diff --git a/filters_test.go b/filters_test.go index 4a511f6..30db2ba 100644 --- a/filters_test.go +++ b/filters_test.go @@ -20,7 +20,7 @@ var _ = Suite(&TestSuite1{}) func (s *TestSuite1) TestFilters(c *C) { // Markdown - c.Assert(pongo2.RenderTemplateString("{{ \"**test**\"|markdown|safe }}", nil), Equals, "

test

\n") + c.Assert(pongo2.RenderTemplateString("{{ \"**test**\"|markdown }}", nil), Equals, "

test

\n") // Slugify c.Assert(pongo2.RenderTemplateString("{{ \"this is รค test!\"|slugify }}", nil), Equals, "this-is-a-test")