Skip to content

[6.x] Antlers HTML instrumentation - #15728

Open
JohnathonKoster wants to merge 21 commits into
6.xfrom
feat/antlers-html-instrumentation
Open

JohnathonKoster wants to merge 21 commits into
6.xfrom
feat/antlers-html-instrumentation

Conversation

@JohnathonKoster

Copy link
Copy Markdown
Contributor

This PR adds opt-in instrumentation to Antlers. When enabled, comments are injected into the rendered HTML that point back to the template expression that produced each bit of output

What the output looks like

Given this template:

<section class="hero">
  <h1>{{ title }}</h1>
  <input value="{{ title }}">
  {{ if show }}<p>{{ body }}</p>{{ /if }}
</section>

you get this (payloads trimmed):

<section class="hero">
  <h1><!-- antlers:start eyJ0eXBl… -->Hello<!-- antlers:end 1 --></h1>
  <input value="Hello">
  <!-- antlers:start eyJ0eXBl… --><p><!-- antlers:start eyJ0eXBl… -->World<!-- antlers:end 3 --></p><!-- antlers:end 2 -->
</section>

The start marker payload is base64 JSON:

{
  "type": "single",
  "engine": "antlers",
  "expression": "title",
  "line": 2,
  "start": 29,
  "end": 40,
  "context": "element-content",
  "element": "h1",
  "view": "page.antlers.html",
  "id": 1
}

Docs/API

Docs and API are still a work in progress; most of the API surface area has been marked internal to discourage third-party use (for now) and to allow freedom to change things without worrying about backwards compatibility, and also not sit on this feature set until its "perfect" 🙂

@JohnathonKoster JohnathonKoster changed the title Feat/antlers html instrumentation [6.x] Antlers HTML instrumentation Oct 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant