Closed zck closed 4 years ago
Looks good. I'm curious why you aren't emitting <p/>
.
As it turns out, according to the spec, only void elements or foreign elements are allowed to self-close. And <p>
is neither of these. The closing </p>
is allowed to be sometimes omitted, but you can't ever self-close the tag.
Huh! Good to know, thanks.
Also add a few tests around html generation.
I'm making this a PR so I can look at it when it's not late, and also because this slightly changes the
para
function. Previously, it never put an ending tag.Now, it results in:
Closing tags are sometimes required by the html spec. Anarki never put them in, even when required. Now it always will.
This also adds self-closed tags, like
This is allowed in void elements, and required in foreign elements (see the spec). Even though they are optional in void elements, I find it much more readable to know that these elements do not have a body.