Markdown OKF-Schema Studio

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
Givena document whose first block is <div align="center">, then after a blank line an <img src width height alt>, a Markdown heading and a Markdown badge row, then </div>
Whenthe document is rendered
Thenthe preview holds one `div` with `align="center"` whose content is the image at its width and height, the heading and the badge row, each Markdown block rendered as Markdown
nominalElements kept
SourceRendered 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> blocka 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 markupnot recognised
nominalThe allow-list of tags
KindTags kept (attributes are kept per tag from a fixed list)
blockdiv, p, center, blockquote, ul, ol, li, dl, dt, dd, details, summary, figure, figcaption, hr, h1 to h6
inlinespan, br, img, a, picture, source, sub, sup, b, i, em, strong, u, s, del, ins, small, kbd, code, mark
dropped with their contentscript, style, iframe, object, embed, textarea, noscript, template, svg, math, title, xmp, frameset, applet
nominalEdit mode
Givenedit mode is on
Whena `div`, `p` or `picture` block is rendered
Thenit is shown as an admonition-like block titled with its literal opening tag in code font, for example <div align="center"> (shortened with an ellipsis when long), and a click on it edits the raw source lines of the block only; read mode shows no frame and no title
nominalKbd renders as a key cap
InputOutcome
the text 'Press' followed by a kbd element containing Ctrla kbd element with the key text is present
a kbd block holding Ctrla key element shows
a kbd element beside an unsupported tagkbd is kept and the unsupported tag is absent
refusalKbd with attributes
Givena kbd element with an onclick attribute
Whenthe preview is rendered
Thenno attributed kbd element is rendered
refusalNothing active survives
Givenraw HTML with <script>, <iframe>, an `onclick` or `onerror` attribute, a `style` or `class` attribute, a `javascript:` link or an unknown element
Whenthe document is rendered
Thenthe script, iframe and unknown elements are dropped (with their content for script, style and iframe) and no event handler, style, class or script URL reaches the page; the sanitizer allows no attribute it did not already allow
InputOutcome
a div block with text and an inline marquee elementthe elements are absent from the HTML
a raw iframe blocknothing of it appears

Implemented in 4

Tested by 6

Replaces

SwRS-MDOKFSTUDIO-CORE-044Drop unsupported raw HTML superseded superseded by SwRS-MDOKFSTUDIO-CORE-071 Markdown file
SwRS-MDOKFSTUDIO-CORE-062Render details and kbd blocks superseded superseded by SwRS-MDOKFSTUDIO-CORE-071 Markdown file
SwRS-MDOKFSTUDIO-GFM-029A small raw HTML subset renders and the rest is dropped superseded superseded by SwRS-MDOKFSTUDIO-CORE-071 Markdown file
SwRS-MDOKFSTUDIO-GFM-030Raw kbd renders as a key cap superseded superseded by SwRS-MDOKFSTUDIO-CORE-071 Markdown file
SwRS-MDOKFSTUDIO-GFM-033Unsupported raw HTML is dropped superseded superseded by SwRS-MDOKFSTUDIO-CORE-071 Markdown file