It's not necessary anymore to apply the 'safe'-filter on markdown-filters.
This commit is contained in:
parent
9ab531beb8
commit
4a22cf2ef9
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -20,7 +20,7 @@ var _ = Suite(&TestSuite1{})
|
||||
|
||||
func (s *TestSuite1) TestFilters(c *C) {
|
||||
// Markdown
|
||||
c.Assert(pongo2.RenderTemplateString("{{ \"**test**\"|markdown|safe }}", nil), Equals, "<p><strong>test</strong></p>\n")
|
||||
c.Assert(pongo2.RenderTemplateString("{{ \"**test**\"|markdown }}", nil), Equals, "<p><strong>test</strong></p>\n")
|
||||
|
||||
// Slugify
|
||||
c.Assert(pongo2.RenderTemplateString("{{ \"this is ä test!\"|slugify }}", nil), Equals, "this-is-a-test")
|
||||
|
Loading…
Reference in New Issue
Block a user