-
-
Notifications
You must be signed in to change notification settings - Fork 339
Description
HTML includes void elements (elements without closing tags). Among these, the behavior of phrasing content (inline elements) when written in raw HTML is undefined in CommonMark.
Void elements are documented at https://developer.mozilla.org/en-US/docs/Glossary/Void_element. Within this, the following four are phrasing content:
- br
- embed
- img
- input
- wbr
When these elements appear alone, Markdown should treat them as elements within a paragraph. However, the current reference implementation does not do this.
input
<img src="https:/example.com/image.png" alt="An image" title="Image title" />
<input type="text" name="name" value="value">
<br>
<wbr />
current actual output
<img src="https:/example.com/image.png" alt="An image" title="Image title" />
<input type="text" name="name" value="value">
<br>
<wbr />
expected output
<p><img src="https:/example.com/image.png" alt="An image" title="Image title" /></p>
<p><input type="text" name="name" value="value"></p>
<p><br></p>
<p><wbr /></p>
Why I think these should be wrapped in p elements
Currently, standalone Markdown image element or two or more consecutive raw <br>
elements are wrapped in a <p>
element. Therefore, for consistency, I believe these void elements should also be wrapped when they appear alone.
input

<br><br>
current output
<p><img src="https://example.com/img.png" alt="img.png"></p>
<p><br><br></p>