Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Confusing error message when not closing an element #56
Comments
|
This is something we gave up when moving from using the browser's HTML parser to a custom parser in 2.0. The tradeoffs of being able to run directly in Node.js and reducing the library size were good, but we have heard from a few people that some of the niceties of HTML like this would be pleasant to have back. I'm not sure how feasible it is to implement void elements, since its a whitelist. Perhaps we could move validation into something like an editor plugin? |
I just realized that i don't understand why a small library size would be a goal of this library My understanding is that for most libraries, the size of the library is a necessary cost to be paid for the functionnality it offers However, for Under these circumstances, i see using the |
|
I understand that for some use-cases, the library size is less important. However, there are potential performance reasons to use htm without transpiling in production - including some interesting tradeoffs for JS parsing time. At 400-500 bytes, those tradeoffs are often worthwhile. A 10kb implementation with pretty warnings and english messages would likely invalidate that. |
|
Just an addendum: I think it would be both possible and reasonable to add extended parser error messages to |
Example code:
Being used to write HTML and not having to close every element (especially inputs), i can write this sort of code
With
htm, i get the following error:SyntaxError: missing ) after argument listThis errors seems non-intuitive to me