Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-GFM-031

Raw HTML tables are rebuilt from an allow-list

When a document contains a raw HTML table, the extension SHALL rebuild it from an allow-list of tags and attributes, rendering its cells with rowspan and colspan from 1 to 999, align, scope, simple class names, title and a sanitized style subset, and removing script, style, iframe, svg, form, embed and object elements with their content and dropping comments.

Step 2 of path 2 in StRS-MDOKFSTUDIO-GFM-002: from “The alert is drawn as an admonition, and the document holds a raw HTML table” to “The raw HTML table is drawn with its spans and safe colours”.

Step 2 of path 2 in StRS-MDOKFSTUDIO-MYST-017: from “A document holds a raw HTML table” to “The tables are shown as tables”.

Scenarios 6

The situations the tests check; open one to read it.

nominalSpans preserved
Givena raw table with colspan=2 and rowspan=2 cells
Whenthe preview is rendered
Thenthe cells span as written
boundarySpan limits
Givencells with colspan=999, colspan=1000 and rowspan=0
Whenthe preview is rendered
Then999 is kept and the out-of-range values 1000 and 0 are not applied
nominalSafe colours kept
Givena cell style 'color: red; background-color: #fff' or 'color: hsl(0,0%,0%)'
Whenthe preview is rendered
Thenboth declarations are kept (the style keeps only text and background colours, text-fill, background-clip text and linear gradients; every colour follows the colour grammar of SwRS-MDOKFSTUDIO-GFM-034, so var(), url(), !important, comments, escapes and names outside the closed list and the keywords currentcolor, inherit, initial and unset are removed; the space form rgb(0 0 0 / 50%) is kept)
refusalUnsafe style removed
Givena cell style 'position: fixed; background: url(x)'
Whenthe preview is rendered
Thendeclarations are removed and a diagnostic is recorded
refusalActive content removed
InputOutcome
a raw table cell containing a script element and an iframe element with text insideboth are removed with their content
a table cell with a script elementthe script is dropped
style, svg, form, embed or object elements in a cellremoved with their content
boundaryUnknown tag and comment
Givena cell with an unknown tag around text and an HTML comment
Whenthe preview is rendered
Thenthe tag is unwrapped, its text is kept and the comment is dropped

Implemented in 2

Tested by 2

Replaces

SwRS-MDOKFSTUDIO-CORE-056Rebuild raw HTML tables from an allow-list superseded superseded by SwRS-MDOKFSTUDIO-GFM-031 Markdown file
SwRS-MDOKFSTUDIO-GFM-032Raw table styles keep a sanitized subset superseded superseded by SwRS-MDOKFSTUDIO-GFM-031 Markdown file
SwRS-MDOKFSTUDIO-GFM-038Raw HTML tables remove active content superseded superseded by SwRS-MDOKFSTUDIO-GFM-031 Markdown file