You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I put HTML inside an indent filter, the HTML is escaped and becomes <, >, ", etc.
Reproduction steps
Here is a sample code that shows the issue.
use minijinja::{Environment};#[tokio::main]asyncfnmain(){letmut env = Environment::new();
env.add_template("example.html","<p>this is outside the filter</p>{%- filter indent(4) %} <p>this is inside</p>{%- endfilter -%} ").unwrap();let example = env.get_template("example.html").unwrap();println!("{}", example.render(()).unwrap());}
Here is the output I get from cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.17s
Running `target\debug\test_app.exe`
<p>this is outside the filter</p>
<p>this is inside</p>
Additional helpful information:
I only noticed this issue when the file ended in .html. When I tried to add the extension .jinja or .j2 this issue did not occur. I originally saw this happening when I had a base.html and index.html which extended from the base, where everything inside the {% block content %} rendered with escaped HTML. I simplified it down to the example shown above.
Version of minijinja: 1.0.6
Version of rustc: 1.71.1
Operating system and version: Windows 11 Pro 22H2
What did you expect
As a practice project, I'm rewriting one of my python flask apps to have a Rust backend. I expected the HTML to render as HTML without the <, >, similar to how it worked when I used Python.
The text was updated successfully, but these errors were encountered:
Description
When I put HTML inside an indent filter, the HTML is escaped and becomes
<
,>
,"
, etc.Reproduction steps
Here is a sample code that shows the issue.
Here is the output I get from
cargo run
Additional helpful information:
I only noticed this issue when the file ended in
.html
. When I tried to add the extension.jinja
or.j2
this issue did not occur. I originally saw this happening when I had abase.html
andindex.html
which extended from the base, where everything inside the{% block content %}
rendered with escaped HTML. I simplified it down to the example shown above.What did you expect
As a practice project, I'm rewriting one of my python flask apps to have a Rust backend. I expected the HTML to render as HTML without the
<
,>
, similar to how it worked when I used Python.The text was updated successfully, but these errors were encountered: