Skip to content

Propose a templating language? #49

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

Open
iandunn opened this issue Apr 21, 2021 · 1 comment
Open

Propose a templating language? #49

iandunn opened this issue Apr 21, 2021 · 1 comment
Labels
question Further information is requested

Comments

@iandunn
Copy link
Member

iandunn commented Apr 21, 2021

Similar to prepared statements (#44), a templating language like Twig et al could reduce a lot of complexity when it comes to escaping. In React, output is escaped by default, and you have to use dangerouslySetInnerHTML() to intentionally output raw HTML. IMO, that's the correct approach from a security perspective.

It's also very convenient that the templating language detects the context for you, so you just write {{ $foo }} everywhere, and it knows when it should use esc_html vs esc_attr vs esc_url, etc. You can still override the default with things like {{ $foo|my_custom_escaping_function }} if needed.

That would be a huge shift for the WP ecosystem, but could be worth considering.

@iandunn iandunn added the question Further information is requested label Apr 21, 2021
@iandunn
Copy link
Member Author

iandunn commented Apr 28, 2021

I missed this earlier, but there's already #33472-core :)

It might be worth keeping this open for a bit, just to consider whether that's something we should try to help move forward as part of this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant