Skip to content

Inline Processing

tl:inline enables inline expression syntax inside an element's text content, so you can interpolate values without wrapping every one in its own tl:text element.

tl:inline – inline expressions

Set tl:inline to the content mode. Inside the element, [[${expr}]] emits escaped output and [(${expr})] emits unescaped output:

<p tl:inline="text">Hello, [[${name}]]! Today is [(${rawHtml})].</p>

The supported modes are text, javascript, css, and none.

JavaScript blocks

<script tl:inline="javascript">
  var user = [[${user.name}]];
</script>

Style blocks

<style tl:inline="css">
  .alert { color: [[${alertColor}]]; }
</style>

Security: in javascript and css modes, inline output is escaped – including </script> and </style> closing sequences – to prevent context breakout. Only template text is inlined: [[...]] in the output of tl:text, tl:utext or another inline expression, or in a text node a custom processor adds, stays literal, also when tl:insert brings that output into a tl:inline element. A custom processor that edits a template text node in place keeps it inlined, so it must never write a value there.