-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
DOCTYPE declaration causes strangeness in the vscode extension #17
Comments
Thanks for checking out the project! You've definitely found a bug in the parser. The parser bug is that Just in case it's not clear, You'll find that HTML text and comments aren't currently supported by
|
By the way, you can use a "code" component to work around the lack of
And you should be able to use it like:
I could add some "code" components like this to templ so that people can use them, but I think it's better not to surprise people too much, and I think it's pretty easy to support Would love to hear your thoughts! |
Take a look at the commit above. There's an example of |
I've also fixed the issue with templ declarations being removed, and improved the error messages above. Let me know if there's any problems. Feel free to reopen if you want to discuss anything. These changes are included in this release and later: https://github.com/a-h/templ/releases/tag/v0.0.126 |
When creating a .templ file I noticed a very strange thing happening if the layout had a doctype declaration.
For example, this code (which looks like it should be valid to me):
when this was saved in vscode, immediately turns into:
i.e. the actual templ declarations were removed.
The actual layout was much more detailed but I distilled it down to the fact that if any templ declaration with a doctype declaration exists in the templ file then all templ declarations are removed, but only if the first templ declaration is the one that contains the doctype. Having the templ declarations the other way round (Layout1 first, followed by Layout) it works fine.
I hope it's just me.
Any ideas?
The text was updated successfully, but these errors were encountered: