Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-REVIEW-133

HTML comments show as gray chips carried as data

When a document holds an HTML comment that is not a tool comment, the renderer SHALL write a gray chip labelled comment at the place of the comment, with the comment text kept as a text node in a hidden body and never written as HTML.

Step 1 of path 1 in StRS-MDOKFSTUDIO-REVIEW-012: from “A document holds an HTML comment” to “A chip stands in the text”.

Scenarios 9

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

nominalOne-line block comment
Givena comment on line 3 between two paragraphs
Whenthe document is rendered
Thena block wrapper with data-line 3 and data-end-line 3 holds a chip reading comment, with role button, tabindex 0 and the comment text as title, and a hidden body with the same text
nominalMulti-line block comment
Givena comment from line 1 to line 4
Whenthe document is rendered
Thenthe wrapper spans lines 1 to 4 and the chip title keeps both text lines
nominalInline comment
InputOutcome
The text "a `<!-- inline note -->` b"The paragraph holds a span wrapper with a chip titled inline note and a hidden span body with that text
A heading "## Plan `<!-- TODO fix later -->`"The heading holds the chip and its attributes are those of the heading without the comment
A comment in a table cellA gray chip is written inside the cell (untested)
refusalComment text is never rendered as HTML
InputOutcome
A comment holding an img tag with an onerror attributeThe hidden body holds the tag as text and no element is created from it
A comment directly followed by a paragraph with markupThe markup is rendered as usual and not inside the comment
nominalSeveral comments and comments next to lists
InputOutcome
The line "`<!-- a -->` `<!-- b -->`"Two chips are written, one for each comment
Comments before a list, between two items and after the listEach comment is a chip labelled comment, and the TODO comment is a green TODO chip, never a chip labelled with the comment opener
A raw HTML table next to commentsThe table is unchanged
refusalTool comments get no chip
InputOutcome
Comments markdownlint-disable MD013, prettier-ignore, toc, cspell:disable and vale offNo chip and no comment wrapper is written
A markdownlint comment and a note on one lineOnly the note gets a chip (untested)
A comment starting with another wordA chip is written
boundaryContext tags with a comment inside
InputOutcome
A context block holding inner TODO textThe admonition is produced and holds one chip
A context block holding a commentThe admonition holds the comment wrapper
boundaryChips after the sanitizer
InputOutcome
A rendered comment chip is sanitizedThe chip keeps role button, tabindex 0 and its title
A chip with an onclick attribute is sanitizedThe attribute is removed (deduced from the test name, not asserted separately)
boundaryAn HTML comment inside a tab item keeps its own source lines
Givena tab item that holds a paragraph and the comment `<!-- review: inner -->` on line 5
Whenthe document is rendered
Thenthe comment wrapper carries data-line 5 and data-end-line 5, the tab panel stays one block, and the paragraph beside the comment carries no source line

Implemented in 2

Tested by 2