Global attributes

RTCode.io adds attributes that work on any HTML element. They turn elements into files, add response headers, hide content, decide who may view a deployment, steer the live sync, and leave notes for agents. They sit beside the standard global attributes and are written the same way. This page lists them all and links to the page of each one.

Each entry says where the attribute works: in the playground, on RTEdge.net, or in both.

Writing the attributes

The attributes are ordinary HTML attributes whose names contain a colon. In o:=nav.js the attribute name is o: and the value is nav.js; the colon belongs to the name and does not appear in URLs. The HTML parser lowercases attribute names, so header names written as h:* arrive in lowercase. Write values unquoted unless they contain spaces, = or quotes.

html
<script type=module o:=greet.js h:cache-control="public, max-age=300">
  export const greet = name => `Hello, ${name}!`
</script>

Files and assets

Turn an element into a file, choose its body, type and headers, or hand its content to a worker. See Exporting files, Building a multi-page site and Sibling routes.

i:Playground only

Marks an element whose content can be fetched from a URL into the editor on demand.

o:

Exports an element as a file served at /name.ext in the playground and on RTEdge.net.

o:type

Sets the content type of an exported file or worker asset.

o:content

Chooses which property of the element becomes the exported file's body.

h:*

Adds a response header to an exported file or worker asset.

worker:fs

Binds the element's content to the worker as an env.FS asset.

Redaction

Keep content out of copies or out of the served page. None of these attributes hides content from the deployed source; see Keeping secrets out.

copy:redactPlayground only

Replaces the element with a comment when the source is copied to the clipboard.

edge:redact

Replaces the element with a comment in the deployed page.

edge:remove

Removes the element from the deployed page.

Access

Decide who may view a deployment and who may open its source. These attributes are read when you deploy and enforced on RTEdge.net. See Restricting access.

edge:user

Restricts who may view a deployment.

io:user

Restricts who may open a deployment's source in RTCode.io.

io:guest

Lets anyone open the source of a deployment that has an edge worker.

edge:guestExperimental

On the same element as edge:user, cancels that element's edge:user list. On any other element it has no effect. edge:guest may change.

Sync control

Steer how the output follows your edits. These attributes work in the playground and stay in the deployed HTML as inert attributes. See Live sync and reloads.

syncPlayground only
sync=reload makes every edit reload the output. sync=pure Experimental marks a custom element as safe to hot-patch.
oi:excludePlayground only

Keeps runtime changes to an element out of the source when the page syncs back.

oi:indentPlayground onlyExperimental

A space-separated list of lowercase tag names. It changes how RTCode.io writes HTML back as text: Selection: Get HTML (Alt+H H), Input: Fetch and Empty [i:], and copies of copy:redact content. Inside a listed tag, every element starts on a new line, indented by two spaces for each enclosing listed level, and the closing tag of a listed element that has child nodes goes on its own line. Descendants inherit the list. The attribute never affects live reverse sync.

html
<ul oi:indent=ul><li>One</li><li>Two</li></ul>

Selecting that line and running Selection: Get HTML produces:

html
<ul oi:indent=ul>
  <li>One</li>
  <li>Two</li>
</ul>

Note: oi:indent may change.

Tab title and icon

io:-Playground onlyExperimental

Keeps the output's own title and icon in the playground's browser tab. On the output's <title>, the tab shows the text as written, without the RTCode prefix. On a <link rel=icon>, the tab uses that icon unchanged; otherwise the icon is drawn at half size over a desaturated RTCode logo.

html
<title io:->My app</title>
<link rel=icon href=//rtcode.io/.svg io:->

Note: io:- may change.

Agents

Leave instructions for the AI agents that work in your source.

ai

Leaves a short instruction for AI agents on an element.

Attributes of one element

A few attributes only make sense on one element. They are documented with that element:

<script type=worker>
edge, io:host and io:fail.
<script>
reload and pure.
<meta io:sync>
io:sync.

Comparison

AttributeApplies toPlaygroundRTEdge.netStripped on deploy
i:Any elementFetch and Empty commands fill and empty the element.No effect.Yes
o:Any elementServed at /name.Served at <route>/name.Yes
o:typeAn element with o: or worker:fsSets the type; ;charset=utf-8 is appended.Sets the type as written.Yes
o:contentAn element with o: or worker:fsChooses the body.Chooses the body.Yes
h:*An element with o: or worker:fsApplied in part.Sent as written.Yes
worker:fsAny elementAn env.FS entry.An env.FS entry.Yes
copy:redactAny elementRedacts copies from the editor.No effect.No
edge:redactAny elementNo effect.Replaces the element with a comment.Yes
edge:removeAny elementNo effect.Blanks the element.Yes
edge:userAny element, usually <meta>Not enforced.Limits who may view.Yes
io:userAny element, usually <meta> or an edge workerNot enforced.Limits who may open the source.Yes
io:guestAn edge worker, or the element that has io:userNot enforced.Lets anyone open the source.Yes
syncAny elementControls reloads.No effect.No
oi:excludeAny elementKeeps runtime changes out of the source.No effect.No
oi:indentAny elementShapes serialized HTML.No effect.No
io:-<title>, <link rel=icon>Keeps the tab title and icon.No effect.Yes
aiAny elementRead by agents.Served as written; read by agents.No

What deploy does to attributes

Deploy removes every attribute whose name starts with i:, o:, io:, edge:, h: or worker: from every element of the served page and of exported files, including inside templates. The deployed source, which ? opens, keeps them all.

These attributes stay in the served HTML as inert attributes: oi:exclude, oi:indent, copy:redact, sync, reload, pure and ai.

Note: Code that selects an RTCode attribute at run time, for example [o\:=".css"], finds the element in the playground but not after deploy, because the attribute is gone.

See also