Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest disable html escaping in templates in templates section #1089

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

malteneuss
Copy link
Contributor

Suggest in the book that when rendering Html templates in templates, we may want to disable Html escaping.

Fixes #1088

Copy link
Collaborator

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -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|escape("none") }}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use safe instead of escape("none"), which is a little more concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@malteneuss malteneuss requested a review from djc August 26, 2024 12:20
@djc djc merged commit a6f95cd into rinja-rs:main Aug 26, 2024
16 checks passed
@malteneuss malteneuss deleted the patch-2 branch August 26, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Templates in templates need "none" escape
2 participants