text [TEXT]
Creates an escaped HTML text fragment.
Block type: REPORTER. Opcode: text. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
TEXT | STRING | Hello <world> |
Complete block reference (44 blocks)
TurboWarp HTML builds HTML as immutable structured fragments. Blocks create escaped text, elements, attributes, and sibling sequences; the final HTML string is produced only by an explicit render block.
text [Server status]
h1 [text result]
body [h1 result]
html [body result]
render HTML [html result]
onclick are rejected.javascript: are rejected for link and image URLs.iframe elements are rejected; use the dedicated Scratch, TurboWarp, or same-site Packager project iframe blocks for playable embeds.style [CSS]; JavaScript remains unsupported.| Category | Blocks |
|---|---|
| Content | text, concat, render, renderWithValidation |
| Document | html, head, body, title |
| CSS | style, normally placed inside head |
| Text structure | h1 through h6, p, div, span |
| Links and media | link, externalLink, image, turbowarpProjectFrame, scratchProjectFrame, packagedProjectFrame |
| Lists and tables | ul, ol, li, table, tr, th, td |
| Forms | form, label, input, textarea, select, option, button |
For turbowarp-http-server, pass the rendered string as the response body and set Content-Type: text/html; charset=utf-8. The HTTP server does not need to depend on this package.
Use class attributes on elements and define those classes with style [CSS] in head. CSS is useful for teaching presentation and layout, but it can also visually hide or imitate UI, so load projects only from trusted sources.
The package also exports block-free builder functions from @kubohiroya/turbowarp-html, including text, element, common element factories, externalLink, turbowarpProjectFrame, scratchProjectFrame, packagedProjectFrame, withAttribute, concat, render, renderWithValidation, and validate.
All 44 blocks are documented below, including compatibility blocks and blocks available through optional features. Select a block to read its behavior, arguments, default values, and menu choices. Each block has a permanent link.
text [TEXT]Creates an escaped HTML text fragment.
Block type: REPORTER. Opcode: text. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
TEXT | STRING | Hello <world> |
element [TAG] content [CONTENT]Creates a valid HTML element with escaped structured content.
Block type: REPORTER. Opcode: element. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
TAG | STRING | section | |
CONTENT | STRING | |
[ELEMENT] with attribute [NAME] = [VALUE]Returns a new element with a safe escaped attribute value.
Block type: REPORTER. Opcode: withAttribute. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
ELEMENT | STRING | | |
NAME | STRING | class | |
VALUE | STRING | card |
[LEFT] followed by [RIGHT]Creates a fragment sequence from two HTML fragments.
Block type: REPORTER. Opcode: concat. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
LEFT | STRING | | |
RIGHT | STRING | |
render HTML [FRAGMENT]Renders an HTML fragment to final HTML text without updating stored validation errors.
Block type: REPORTER. Opcode: render. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
FRAGMENT | STRING | |
render HTML with validation [FRAGMENT]Validates an HTML fragment, stores any validation errors, and renders final HTML text.
Block type: REPORTER. Opcode: renderWithValidation. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
FRAGMENT | STRING | |
last HTML validation errorsReturns validation errors stored by the most recent render HTML block.
Block type: REPORTER. Opcode: lastValidationErrors. Permanent link
This block has no arguments.
last rendered HTML has validation errors?Reports whether the most recent render HTML block stored validation errors.
Block type: BOOLEAN. Opcode: lastRenderHasValidationErrors. Permanent link
This block has no arguments.
validate HTML [FRAGMENT]Returns simple validation diagnostics for an HTML fragment.
Block type: REPORTER. Opcode: validateHtml. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
FRAGMENT | STRING | |
HTML [FRAGMENT] is valid?Reports whether simple validation found no HTML errors.
Block type: BOOLEAN. Opcode: isValidHtml. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
FRAGMENT | STRING | |
link [CONTENT] URL [URL]Creates an anchor with a conservatively validated URL.
Block type: REPORTER. Opcode: link. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | TurboWarp | |
URL | STRING | https://turbowarp.org/ |
external link [CONTENT] URL [URL]Creates an anchor that opens in a new tab with safe rel attributes.
Block type: REPORTER. Opcode: externalLink. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | TurboWarp | |
URL | STRING | https://turbowarp.org/ |
image URL [SRC] alt [ALT]Creates a void image element with safe src and escaped alt text.
Block type: REPORTER. Opcode: image. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
SRC | STRING | /status.png | |
ALT | STRING | status |
TurboWarp project [PROJECT_ID] iframe title [TITLE] width [WIDTH] height [HEIGHT]Creates a safe iframe for playing a TurboWarp project.
Block type: REPORTER. Opcode: turbowarpProjectFrame. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
PROJECT_ID | STRING | 414716080 | |
TITLE | STRING | TurboWarp project | |
WIDTH | STRING | 482 | |
HEIGHT | STRING | 412 |
Scratch project [PROJECT_ID] iframe title [TITLE] width [WIDTH] height [HEIGHT]Creates a safe iframe for playing a Scratch project.
Block type: REPORTER. Opcode: scratchProjectFrame. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
PROJECT_ID | STRING | 104 | |
TITLE | STRING | Scratch project | |
WIDTH | STRING | 485 | |
HEIGHT | STRING | 402 |
packaged TurboWarp project iframe URL [SRC] title [TITLE] width [WIDTH] height [HEIGHT]Creates a safe iframe for playing a same-site TurboWarp Packager HTML file.
Block type: REPORTER. Opcode: packagedProjectFrame. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
SRC | STRING | ./project.html | |
TITLE | STRING | Packaged TurboWarp project | |
WIDTH | STRING | 480 | |
HEIGHT | STRING | 360 |
html [CONTENT]Creates an html element.
Block type: REPORTER. Opcode: html. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
head [CONTENT]Creates a head element.
Block type: REPORTER. Opcode: head. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
body [CONTENT]Creates a body element.
Block type: REPORTER. Opcode: body. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
title [CONTENT]Creates a title element.
Block type: REPORTER. Opcode: title. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Status |
style [CSS]Creates a style element for educational CSS.
Block type: REPORTER. Opcode: style. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CSS | STRING | .card { color: red; } |
h1 [CONTENT]Creates an h1 element.
Block type: REPORTER. Opcode: h1. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Server status |
h2 [CONTENT]Creates an h2 element.
Block type: REPORTER. Opcode: h2. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Heading |
h3 [CONTENT]Creates an h3 element.
Block type: REPORTER. Opcode: h3. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Heading |
h4 [CONTENT]Creates an h4 element.
Block type: REPORTER. Opcode: h4. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Heading |
h5 [CONTENT]Creates an h5 element.
Block type: REPORTER. Opcode: h5. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Heading |
h6 [CONTENT]Creates an h6 element.
Block type: REPORTER. Opcode: h6. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Heading |
p [CONTENT]Creates a paragraph element.
Block type: REPORTER. Opcode: p. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Ready |
div [CONTENT]Creates a div element.
Block type: REPORTER. Opcode: div. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
span [CONTENT]Creates a span element.
Block type: REPORTER. Opcode: span. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
ul [CONTENT]Creates an unordered list element.
Block type: REPORTER. Opcode: ul. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
ol [CONTENT]Creates an ordered list element.
Block type: REPORTER. Opcode: ol. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
li [CONTENT]Creates a list item element.
Block type: REPORTER. Opcode: li. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | item |
table [CONTENT]Creates a table element.
Block type: REPORTER. Opcode: table. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
tr [CONTENT]Creates a table row element.
Block type: REPORTER. Opcode: tr. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
th [CONTENT]Creates a table header cell element.
Block type: REPORTER. Opcode: th. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Name |
td [CONTENT]Creates a table data cell element.
Block type: REPORTER. Opcode: td. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Value |
form [CONTENT]Creates a form element.
Block type: REPORTER. Opcode: form. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
label [CONTENT]Creates a label element.
Block type: REPORTER. Opcode: label. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Name |
inputCreates a void input element.
Block type: REPORTER. Opcode: input. Permanent link
This block has no arguments.
textarea [CONTENT]Creates a textarea element.
Block type: REPORTER. Opcode: textarea. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
select [CONTENT]Creates a select element.
Block type: REPORTER. Opcode: select. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | |
option [CONTENT]Creates an option element.
Block type: REPORTER. Opcode: option. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Choice |
button [CONTENT]Creates a button element.
Block type: REPORTER. Opcode: button. Permanent link
| Argument | Type | Default value | Menu choices |
|---|---|---|---|
CONTENT | STRING | Submit |