Remove html tags from html code

How to remove tags from html code in Anqi CMS template?

striptagsThe filter can remove all html tags from the html code.

removetagsThe filter can remove the specified tags in the html code.

How to use

striptagsHow to use filters:

{{ obj|striptags }}

removetagsHow to use filters:

{{ obj|removetags:"tag" }}

Multiple tags can be removed, and used between multiple tags,Separate.

For example, remove<strong><i>Hello!</i></strong>The Chinese i tag can be written like this:

{{ "<strong><i>Hello!</i></strong>"|removetags:"i"|safe }}
# Show results
<strong>Hello!</strong>

Sample Demo

{{ "<strong><i>Hello!</i></strong>"|striptags|safe }}
{{ "<strong><i>Hello!</i></strong>"|removetags:"i"|safe }}
{{ "<strong><i>Hello!</i><span>AnQiCMS</span></strong>"|removetags:"i,span"|safe }}
# Show results
Hello!
<strong>Hello!</strong>
<strong>Hello!</strong>