Behaviour SwRS-MDOKFSTUDIO-CORE-071
README-style HTML renders like GitHub and shows its tag in edit mode
When a document holds README-style HTML (div and p with align, br, img with width, height and alt, a around img, picture with colour-scheme sources, sub, sup, kbd), the preview SHALL render those elements like GitHub, keep Markdown after a blank line inside an HTML block rendered, and, in edit mode, show each HTML block as an admonition-like block titled with its literal opening tag, without any script, event handler or style the sanitizer does not already keep. The preview SHALL render a raw details element with an optional open attribute and a plain summary element as a collapsible section, and a kbd element without attributes as a key cap, and SHALL omit raw HTML outside the allow-list of tags and attributes.
Part of StRS-MDOKFSTUDIO-CORE-001, outside the paths drawn on its map.
Part of StRS-MDOKFSTUDIO-GFM-002, outside the paths drawn on its map.
Scenarios 7
The situations the tests check; open one to read it.
nominalREADME header
nominalElements kept
| Source | Rendered as |
|---|---|
| <p align="center"> | a `p` with `align` center (also left, right, justify) |
| `<br>`, `<sub>`, `<sup>`, `<kbd>` | the same element |
| <a href><img></a> | a link around the image |
| <picture> with <source media="(prefers-color-scheme: dark)" srcset> and a fallback <img> | the dark image in a dark preview, the fallback image otherwise, following the preview theme and not the system |
| <details> (optionally `open`) with a plain <summary>, in one block or as a head block, the Markdown between and a closing </details> block | a collapsible section, open when the attribute is set, with the summary as its title and the body rendered; an empty summary reads Details |
| a <summary> holding markup | not recognised |
nominalThe allow-list of tags
| Kind | Tags kept (attributes are kept per tag from a fixed list) |
|---|---|
| block | div, p, center, blockquote, ul, ol, li, dl, dt, dd, details, summary, figure, figcaption, hr, h1 to h6 |
| inline | span, br, img, a, picture, source, sub, sup, b, i, em, strong, u, s, del, ins, small, kbd, code, mark |
| dropped with their content | script, style, iframe, object, embed, textarea, noscript, template, svg, math, title, xmp, frameset, applet |
nominalEdit mode
nominalKbd renders as a key cap
| Input | Outcome |
|---|---|
| the text 'Press' followed by a kbd element containing Ctrl | a kbd element with the key text is present |
| a kbd block holding Ctrl | a key element shows |
| a kbd element beside an unsupported tag | kbd is kept and the unsupported tag is absent |
refusalKbd with attributes
refusalNothing active survives
| Input | Outcome |
|---|---|
| a div block with text and an inline marquee element | the elements are absent from the HTML |
| a raw iframe block | nothing of it appears |