> For the complete documentation index, see [llms.txt](https://trillojs.gitbook.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trillojs.gitbook.io/en/reference/markup.md).

# Markup

Trillo's language is based on HTML, so it has to define how it handles its quirks and how it tries to make our life easier where possible.

## Incomplete markup

Missing tags are automatically inserted and a well formed document is always generated.

```html
<html>
</html>
```

Because the server loads pages in simulated DOM, it fills in the blanks like browsers do. The output markup will therefore include `<!DOCTYPE html>` and the missing `<head>` and `<body>` tags.

## Auto-closed tags

Any tag can be self-closing, e.g. `<br/>` and `<div/>` are both valid and will generate `<br>` and `<div></div>`, respectively.

```html
<html>
<body>
    <br/>
    <div/>
</body>
</html>
```

Basically this extends the common habit of adding `/>` (with or without leading space) at the end of [void tags](https://developer.mozilla.org/en-US/docs/Glossary/Void_element) to any kind of tag, void or not. Both kinds will be generated correctly in the output page.

## Private comments

Comments starting with `<!---` (three dashes) are stripped from the page.

```html
<html>
<body>
  <!-- this comment will appear in output HTML -->
  <!--- this one will not -->
<body>
</html>
```

Sometimes we want our comments to stay private. Plus, by enforcing this rule, Trillo can use its own `<!---` comments in generated markup as markers for its internal working, knowing they cannot conflict with ours.

## Attribute names

Attribute names starting with `:` are valid (they're used to declare [logic values](https://trillojs.dev/docs/reference/language#1-logic-values-)) although they won't directly appear in output pages.

```html
<html :count=[[1]]>
</html>
```

## Attribute values

Attribute values can contain multiline text and unescaped `<` and `>` characters, so it's easy to put JavaScript code inside them. They can be quoted with `'`, `"`, and the `[[` + `]]` special markers. Unquoted attribute values are not supported. In the output all attributes will be standards-compliant of course.

```html
<html id='root'
      lang="en"
      hidden
      data-url=[[window.location.href]]>
</html>
```

> Note that the `attribute=[[...]]` syntax removes the need to escape either `'` or `"` in attribute values, which is convenient when writing JavaScript code. Code editors don't natively support it though, so you may choose to use `"[[...]]"` or `'[[...]]'` and avoid using the quotes inside the expressions, or escape them as per HTML specs, with `&quot;` and `&apos`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trillojs.gitbook.io/en/reference/markup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
