Repository: rinja-rs/askama (language: rust)

Issue:
Templates in templates need "none" escape
When rendering templates in templates like https://github.com/djc/askama/blob/main/book/src/template_syntax.md#templates-in-templates, the inner templates needs to be rendered without escaping; otherwise the Html of the inner template is printed literally.

If that that's the intended behavior, feel free to close this issue.

Otherwise, the tests in https://github.com/djc/askama/blob/main/testing/tests/render_in_place.rs should include Html tags to not miss that in the future. In the mean time, a workaround is to disable escaping manually:

```html
{% for my_template in my_templates %}
      {{ my_template|escape("none") }}
{% endfor %}
```



Discussion / hints:
It's not exactly intended behavior, though I think it is expected behavior. Because of the lack of specialization in Rust, fixing this problem isn't trivial.

Fix patch:
diff --git a/book/src/template_syntax.md b/book/src/template_syntax.md
index 27f36564..70cdbbc6 100644
--- a/book/src/template_syntax.md
+++ b/book/src/template_syntax.md
@@ -584,6 +584,11 @@ let t = RenderInPlace { s1: SectionOne { a: "a", b: "b" } };
 assert_eq!(t.render().unwrap(), "Section 1: A=a\nB=b")
 ```
 
+**Note that if your inner template** like `SectionOne` **renders HTML content, you may want to
+disable escaping** when injecting it into an outer template, e.g. `{{ s1|safe }}`.
+Otherwise it will render the HTML content literally, because
+Askama [escapes HTML variables](#html-escaping) by default.
+
 See the example
 [render in place](https://github.com/djc/askama/blob/main/testing/tests/render_in_place.rs)
 using a vector of templates in a for block.


Test patch: