-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
proposal: ability to render simple text #631
Comments
Thanks for the proposal, I wonder what value add this has over something like:
Would you suggest for control flow statements such as |
Yes, conditions , loops and expressions would be powerful. We can extent this latter even to support markdown. |
It may be powerful, but we need to think about how it would be even possible. The way templ parses Go code is as follows... It looks for a keyword at the start of a node such as If it finds a keyword but then a subsequent step of parsing the statement fails, we don't assume anything, and throw an error. This is why in cases such as In the context of pure text, I'm struggling to see how we would parse it without encountering lots of errors like this. |
Yes, I understand. I will also think. Maybe also discuss it with other collaborators. Thanks for considering it. |
This seems far to error-prone for the parser and JSX also does not allow it, for comparison. What you can do in JSX is either quoted the string |
The mission of templ is to:
So, rendering text isn't part of the plan, but I've suggested how you can use templ to do something similar at #385 (comment) |
Hi,
I am trying to render simple text email using templ. But the templ block formats it and removes all blank lines. I tried using script block as well but it emits <script> tags when rendered.
It would be nice if we add a text block like:
The text block will not get formatted and simply emits text after it is rendered.
Thanks,
Abhi
The text was updated successfully, but these errors were encountered: