Editor markers
The data-brease attributes that let users click content in the preview, and let the AI check its changes.
The editor finds content on the page through three attributes. Add them to every element that renders content.
| Attribute | On | Example |
|---|---|---|
data-brease="<path>" | an element that shows one content value | data-brease="hero.title" |
data-brease="nav:<key>" | the element wrapping a navigation's links | data-brease="nav:main" |
data-brease-block="<Name>" | the root element of each section | data-brease-block="Hero" |
data-brease-sections="sections" | the element holding a page's section list | see Sections |
data-brease-section="<id>" | each section's root, in that list | data-brease-section="sec_01j…" |
Paths
A path points into the page's content, with dots between keys and numbers for array items:
<h1 data-brease="hero.title">{content.hero.title}</h1>
{content.features.items.map((item, i) => (
<li key={i}>
<h3 data-brease={`features.items.${i}.title`}>{item.title}</h3>
<p data-brease={`features.items.${i}.text`}>{item.text}</p>
</li>
))}Content read from another page (site-wide content, an article shown in a list) is prefixed with that page's ID and a colon:
<footer>
<p data-brease={`${global.pageId}:footer.copyright`}>{global.content.footer.copyright}</p>
</footer>Take the ID from the delivery response (page.pageId) rather than writing it into the code.
brease-client has two helpers that build these values:
import { fieldPath, navPath } from 'brease-client'
<h1 data-brease={fieldPath('hero.title')}>…</h1>
<p data-brease={fieldPath('footer.copyright', global.pageId)}>…</p>
<nav data-brease={navPath('main')}>…</nav>What they do
- Edit tool. Clicking an element with a path opens it for editing in place: plain text, rich text or an image, depending on the value. Clicking a
nav:element opens that navigation's editor. - Picking. When a user points the AI at an element, the AI gets its path, section, HTML and the file that renders the section.
- Render check. After the AI changes content, Brease loads the page and checks that the changed paths appear in its markers. Without markers it can't confirm the change, and says so.
- Sections. Brease indexes
data-brease-blocknames to the files that render them, so the AI knows where to look before it searches the code.
The attributes are plain HTML and don't affect your styles. They can stay in production.