A diagnostic is the message Markless gives when it can't
To turn your source files into the code that actually runs.In the glossary
your code: what broke, why, how to fix it, and where to read more.
MARKLESS_COMPILE_BLOCKED: pages/list.tsrx has 1 compiler error(s).
MARKLESS_REPEAT_KEY_REQUIRED: @for (const item of items) repeats reactive state without a key. When items changes, the rows of this list have no identity to update, reorder, or resume by. (pages/list.tsrx:8:4)
MARKLESS_REPEAT_KEY_REQUIRED is the code, and every code has its own page. The sentence after it says what broke, and pages/list.tsrx:8:4 is the file, line and column.
An error has four parts
An error stops the page. In the dev server, the browser shows it on top of the page. Remove the key, then add it back:
pages/list.tsrx
6 <section>
7 <ul>
8
8@for (const item of items) {
<li>{item}</li>
✕ MARKLESS_REPEAT_KEY_REQUIRED
localhost:3000/list
Milk
Eggs
MARKLESS_REPEAT_KEY_REQUIRED
@for (const item of items) repeats reactive state without a key. When items changes, the rows of this list have no identity to update, reorder, or resume by.
pages/list.tsrx:8:4
Why
A keyed loop item keeps its state, events, and DOM attached to the same logical item across reorder, insert, and delete; without a key there is no stable identity root.
Suggested fix
Add a stable domain key such as `@for (const item of items; key item.id)`, or key by position with `index i; key i` when state should follow the slot.
Linus Torvolts reviews your patches, and every rejection lands on a list. The list builds. Try it:
PlaygroundType @ or < for suggestions · F1 explains a wordRestored your edit·
import { state } from '@markless/core';import { INSULTS } from './linus.ts';export default function Review() @{ let items = state([INSULTS[0]]); function send() { const next = INSULTS[items.length]; if (next) items = [...items, next]; } <sectionclass="nak"> <imgsrc="/examples/ink/linus.svg" alt="" /> <h2>Linus reviewed your patch</h2> <ol>@for (const item of items; key item) { <li>{item}</li> } </ol> <buttononClick={send}>Send a patch</button> </section>}
export const INSULTS = [ 'Who taught you tabs?', 'This compiles. That is all it does.', 'My penguin read this and left.', 'Did a toaster write this?', 'Works on your machine? Ship it.', 'A Friday deploy. Bold.',];
To do: Press Send a patch. Linus stamps it NAK with a fresh insult.
To do: Try breaking it: delete ; key item from the @for line. The build stops and the error shows under the result.
To do: Put ; key item back, and press Send a patch twice. The list builds and keeps growing.
A reason silences a warning
A warning is a wavy line in your editor, and the page still builds. To accept one on purpose, write // markless-allow CODE: reason above it:
// markless-allow MARKLESS_REPEAT_KEY_IS_INDEX: a fixed list@for@for · ListShows its block once per item. It needs a key. (const item of items; index i; key i) {
A comment with no reason doesn't silence anything; the figure above shows what happens instead.
All error codes lists every one, grouped by the package that raises it, and each has a page with its fix.