Skip to content

[6.x] Antlers HTML instrumentation - #15728

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

JohnathonKoster wants to merge 24 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 Oct 26, 2026
jasonvarga and others added 3 commits October 29, 2026 17:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nested keys can't be added to published config later since Laravel merges config shallowly. The remaining options still work when set, and default in code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ctype_alpha is locale-dependent, so under a UTF-8 LC_CTYPE a high byte after < was treated as a tag and markers were stripped. HTML tag names must start with an ASCII letter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

2 participants