Skip to content
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

Mark wrong HTML nesting as an error #28

Open
kristoff-it opened this issue Sep 11, 2024 · 3 comments
Open

Mark wrong HTML nesting as an error #28

kristoff-it opened this issue Sep 11, 2024 · 3 comments

Comments

@kristoff-it
Copy link
Owner

kristoff-it commented Sep 11, 2024

The HTML spec defines that some elements cannot be nested in some other elements (eg <div> cannot go under <p>).

The task is to find the complete list, use some judgment to decide if it makes sense for our use case and then add all these cases as errors in the HTML parser code.

@bjorn3
Copy link

bjorn3 commented Sep 11, 2024

Looks like you forgot to escape the html tags, causing them to be hidden in the rendered version of your issue description. Copying the examples from the original lobste.rs comment by someone else: <p><p></p></p> / <p><div></div></p>.

@kristoff-it
Copy link
Owner Author

I got markdown'd, thanks!

@wong-justin
Copy link

wong-justin commented Oct 4, 2024

I think the most comprehensive resource will be MDN. They have a "permitted content" entry for each element. For example, see footer, which can have "flow content, but with no <footer> or <header> descendants."

I could do some scraping to generate a complete list if you want.

EDIT - I went ahead and made a list of all the nesting rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants