--- html-void-element-with-children html ---
// Error: 2-27 HTML void elements must not have children
#html.elem("img", [Hello])
--- html-space-collapsing html ---
// Note: .. = ..
#import html: span
= Single spaces
// No collapsing.
#"A B"
// -> A B
// No collapsing, multiple text elements.
#"A"#" "#"B"
// -> A B
// Across span boundaries: 0-1.
#span[A] B
// -> A B
// With span in between.
#"A "#span()#" B"
// -> A B
// With metadata in between.
#"A "#metadata(none)#" B"
// -> A B
// Within span.
#span("A ")B
// -> A B
= Consecutive whitespace
// Single text element.
#"A B C"
// -> A B C
// Multiple text elements.
A#" "B#" C"
// -> A B C
// Across span boundaries: 1-1.
#span("A ") B
// -> A B
// Across span boundaries: 1-2.
#span("A ")#" B"
// -> A B
// Across span boundaries: 2-1.
#span("A ") B
// -> A B
// Across span boundaries: 2-2.
#span("A ")#" B"
// -> A B
// With span in between.
#"A "#span()#" B"
// -> A B
// With metadata in between.
#"A "#metadata(none)#" B"
// -> A B
= Leading whitespace
// Leading space.
#" A"
// -> A
// Leading space in span.
#span(" ")A
// -> A
// Leading space with preceding empty element.
#span()#" "A
// -> A
= Trailing whitespace
// Trailing space.
#"A "
// -> A
// Trailing space in element.
#span("A ")
// -> A
// Trailing space in element with following empty element.
#span("A ")#span()
// -> A
= Tabs
// Single text element.
#"A\tB"
// -> A B
// Multiple text elements.
#"A"#"\t"#"B"
// -> A B
// Spaces + Tab.
#"A \t B"
// -> A B
= Newlines
// Normal line feed.
#"A\nB"
// -> A
B
// CLRF.
#"A\r\nB"
// -> A
B
// Spaces + newline.
#"A \n B"
// -> A B
// Explicit `
` element.
#"A "#html.br()#" B"
// -> A B
// Newline in span.
#"A "#span("\n")#" B"
// -> A B
= With default ignorables
// With default ignorable in between.
#"A \u{200D} B"
// -> A B
#"A \u{200D} B"
// -> A B
= Everything
// Everything at once.
#span(" A ")#"\r\n\t"B#" "#span()
// -> A B
= Special
// Escapable raw.
#html.textarea("A B")
// ->
// Preformatted.
#html.pre("A B")
// ->
A B--- html-pre-starting-with-newline html --- #html.pre("hello") #html.pre("\nhello") #html.pre("\n\nhello") --- html-textarea-starting-with-newline html --- #html.textarea("\nenter") --- html-script html --- // This should be pretty and indented. #html.script( ```js const x = 1 const y = 2 console.log(x < y, Math.max(1, 2)) ```.text, ) // This should have extra newlines, but no indent because of the multiline // string literal. #html.script("console.log(`Hello\nWorld`)") // This should be untouched. #html.script( type: "text/python", ```py x = 1 y = 2 print(x < y, max(x, y)) ```.text, ) --- html-style html --- // This should be pretty and indented. #html.style( ```css body { text: red; } ```.text, ) --- html-raw-text-contains-elem html --- // Error: 14-32 HTML raw text element cannot have non-text children #html.script(html.strong[Hello]) --- html-raw-text-contains-frame html --- // Error: 14-31 HTML raw text element cannot have non-text children #html.script(html.frame[Hello]) --- html-raw-text-contains-closing-tag html --- // Error: 2-32 HTML raw text element cannot contain its own closing tag // Hint: 2-32 the sequence `") --- html-non-char html --- // Error: 1-9 the character `"\u{fdd0}"` cannot be encoded in HTML \u{fdd0} --- html-raw-text-non-char html --- // Error: 24-32 the character `"\u{fdd0}"` cannot be encoded in HTML #html.script[const x = \u{fdd0}] --- html-escapable-raw-text-non-char html --- // Error: 23-31 the character `"\u{fdd0}"` cannot be encoded in HTML #html.textarea[Typing \u{fdd0}]