Blog

HTML is a value

2 min read

Templates are strings with holes in them. What changes when markup is an ordinary value the language can check, pass around and escape on its own?

A template engine works on text. It glues strings together and hopes the result is HTML. That is why escaping is something you remember to do, and why a missing closing tag shows up in the browser instead of at your desk.

JSX showed a better way: write markup as an expression, and let the compiler turn it into calls. The cost is a build step, and a language (JavaScript) where markup was added afterwards. Quillo's idea is to start there.

Markup in the language

view Card(title: str, children) =    <section.card>        <h2>{title}</h2>        {children}    </section>route GET / = <Card title="Welcome"><p>No build step.</p></Card>

<section.card> is a section with the class card, a shorthand worth having when half of all markup is classes. view names a piece of markup with parameters, which is all a component is when it has nothing to remember.

What the language can do with it

Because markup is a value, not text:

No build step

The server renders views directly. Nothing turns a .qwe file into another file before it runs, so what you read is what serves the page.

Since then: views, the .class shorthand and escaping by default are part of every Quillo page. See HTML literals.

The Quillo newsletterNew posts, components and plugins, about once a week. No tracking.

Thread
6Useful? Like it, or add to its thread below.

Thread 0 posts

On HTML is a value: questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.