-
I looked briefly at the website https://stephannv.github.io/blueprint-docs/ but didn't see any mention of this. One of the most important things in HTML templating is escaping content which isn't supposed to be HTML. Ruby/ERB has an elegant strategy for this which is transparent to the programmer in most cases, while other languages require a lot of hand-holding to produce safe markup from user-submitted content. What does blueprint have in this area? How would it handle, eg: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Blueprint escapes all content and attributes when rendering.
Tests: https://github.com/stephannv/blueprint/blob/main/spec/blueprint/html/safety_spec.cr Example: span { "<script>alert('hello')</script>" }
input(class: "some-class\" onblur=\"alert('Attribute')") Output: <span><script>alert('hello')</script></span>
<input class="some-class" onblur="alert('Attribute')"> In the next releases I will allow users to bypass this escaping, something like |
Beta Was this translation helpful? Give feedback.
Blueprint escapes all content and attributes when rendering.
On docs: https://stephannv.github.io/blueprint-docs/guides/safety
On code:
Tests: https://github.com/stephannv/blueprint/blob/main/spec/blueprint/html/safety_spec.cr
Example:
Output:
In the next releases I will…