-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Multi-line custom element support #770
Comments
Custom elements are by definition blocks right, and, by definition include a 6. **Start condition:** line begins with the string `<` or `</`
followed by one of the strings (case-insensitive) `address`,
`article`, `aside`, `base`, `basefont`, `blockquote`, `body`,
`caption`, `center`, `col`, `colgroup`, `dd`, `details`, `dialog`,
`dir`, `div`, `dl`, `dt`, `fieldset`, `figcaption`, `figure`,
`footer`, `form`, `frame`, `frameset`,
`h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`,
`html`, `iframe`, `legend`, `li`, `link`, `main`, `menu`, `menuitem`,
`nav`, `noframes`, `ol`, `optgroup`, `option`, `p`, `param`,
`search`, `section`, `summary`, `table`, `tbody`, `td`,
-`tfoot`, `th`, `thead`, `title`, `tr`, `track`, `ul`, followed
+`tfoot`, `th`, `thead`, `title`, `tr`, `track`, `ul`, or
+a [tag name] that includes a dash (`-`), followed
by a space, a tab, the end of the line, the string `>`, or
the string `/>`.\
**End condition:** line is followed by a [blank line]. Example with |
Yes, they always include a dash, so I'd be happy with something like that. I think where the complications have arisen before is they can be inline as well as block (and I believe are actually inline by default according to the spec), even though the vast majority of the time devs set them to block level. IMO, in the rare instances I'd use an inline custom element, I'd be happy to wrap it in a On that note, there is one current workaround where you can manually wrap the custom element in a |
Could someone point me to documentation for custom elements? I'm not familiar. For example, something substantiating the claim that they are invariably block-level and invariably contain |
They're not invariably block-level, which I think is the problem. They're only set to block level most of the time by developers, but that's not the default behavior per spec. (I think this might be due to the initial value of the CSS As per the hyphen, that's outlined in https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name :
|
Should go to type 7 to allow it to be treated both as inline and block elements. |
They are indeed not always block — they were added later to html and treated differently by different algorithms and i believe there was a case where they were thus always essentially “block” (even though there is not really such a thing in HTML as block vs inline), but I can‘t find that, and am probably wrong.
All block type conditions only parse a single line. Condition 7 is what it would currently “end up” as, but that doesn’t work as the OP sample is not on a line. |
related: #239
I have a custom element that has a few very long attribute values, but needs to render without a wrapping
<p>
. It’s entirely unfeasible to write it all in one line (not to mention doing so would require me to update the component to handle escaped newlines, because it expects newlines in the string).I get that the parsing question around this is complicated, but there needs to be a way to handle something like:
This is doubly so now that custom elements are gaining further traction.
There was discussion in #239 and https://talk.commonmark.org/t/raw-html-blocks-proposals-comments-wanted/983/69 includes discussion around the idea of whitelisting vs blacklisting block level elements, but never seemed to resolve that issue. I think, at a bare minimum, there needs to be a way to configure known block level elements, or a flag to treat custom elements as block level (I'm not entirely sure whether that's a spec issue vs. implementation though)
The text was updated successfully, but these errors were encountered: