You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found while reviewing #37 (renderer hardening). Not a bug and not a security issue — #37 closes the escaping hole, so a hostile type string is already rendered as text. This is about the Markdown being more useful to read.
The concrete case: attributes[].type
attributes[].type renders in exactly one place: the Markdown attribute table's Type column, markdown.go:309 via typeCell. The Mermaid ER never sees it — it deliberately omits attributes, since freeform conceptual types like enum[active, archived] aren't valid erDiagram attribute types (mermaid.go:104-108).
typeCell has two branches: a scope.Name whose scope is a bound import becomes a link; everything else falls through to mdCell as plain prose. So the same column renders three ways:
A local enum type isn't linked, but a cross-model one is. That is backwards from what a reader expects. In docs/05-parking-garage/garage.modelith.md, AccountStatus is defined 30 lines above under ### + backticked name, which already generates the anchor #accountstatus. Nothing uses it:
The document has anchors and no internal links to them. Meanwhile a type pointing at another file gets a working link.
The type is the only identifier the renderer doesn't code-span. Attribute names, enum value names, action names, actor names, import scopes and paths all go through codeSpan. The enum's own definition heading is code-spanned. The type cell referencing that enum is bare, so one table row has a code-spanned name sitting next to a bare type.
A code span nests inside a link label in GFM, so both cases can render consistently rather than diverging.
The broader theme
The rendered Markdown has more anchors than it uses. Other candidates, roughly in order of how obviously useful they are:
A relationship's entity: — link to that entity's section.
An action's preserves: and a scenario's invariants_touched: — link to the invariant they name. These are already id references the linter resolves, so the target is known to be valid.
Backticked entity and glossary terms in prose — lint already resolves these for its backticked-term check, so the renderer could link what the linter already matched. This one is the largest and most likely to look noisy; worth prototyping before committing.
The principle: where the linter already resolves a reference, the renderer usually knows enough to link it.
Notes for whoever picks this up
Do it when typeCell is already open. Cross-model imports slice 2 (vendoring, ADR-0010) touches that function for vendored-model links; folding this in there avoids churning the goldens twice.
Goldens will churn across every attribute row in examples/ and docs/05-parking-garage/.
Anchor generation depends on the renderer's heading format, so a test should pin the anchor scheme rather than assuming GitHub's slugging stays put.
Found while reviewing #37 (renderer hardening). Not a bug and not a security issue — #37 closes the escaping hole, so a hostile type string is already rendered as text. This is about the Markdown being more useful to read.
The concrete case:
attributes[].typeattributes[].typerenders in exactly one place: the Markdown attribute table's Type column,markdown.go:309viatypeCell. The Mermaid ER never sees it — it deliberately omits attributes, since freeform conceptual types likeenum[active, archived]aren't valid erDiagram attribute types (mermaid.go:104-108).typeCellhas two branches: ascope.Namewhose scope is a bound import becomes a link; everything else falls through tomdCellas plain prose. So the same column renders three ways:Two things are worth changing.
A local enum type isn't linked, but a cross-model one is. That is backwards from what a reader expects. In
docs/05-parking-garage/garage.modelith.md,AccountStatusis defined 30 lines above under###+ backticked name, which already generates the anchor#accountstatus. Nothing uses it:$ grep -c '](#' docs/05-parking-garage/garage.modelith.md 0The document has anchors and no internal links to them. Meanwhile a type pointing at another file gets a working link.
The type is the only identifier the renderer doesn't code-span. Attribute names, enum value names, action names, actor names, import scopes and paths all go through
codeSpan. The enum's own definition heading is code-spanned. The type cell referencing that enum is bare, so one table row has a code-spanned name sitting next to a bare type.Target:
A code span nests inside a link label in GFM, so both cases can render consistently rather than diverging.
The broader theme
The rendered Markdown has more anchors than it uses. Other candidates, roughly in order of how obviously useful they are:
entity:— link to that entity's section.preserves:and a scenario'sinvariants_touched:— link to the invariant they name. These are already id references the linter resolves, so the target is known to be valid.lintalready resolves these for its backticked-term check, so the renderer could link what the linter already matched. This one is the largest and most likely to look noisy; worth prototyping before committing.The principle: where the linter already resolves a reference, the renderer usually knows enough to link it.
Notes for whoever picks this up
typeCellis already open. Cross-model imports slice 2 (vendoring, ADR-0010) touches that function for vendored-model links; folding this in there avoids churning the goldens twice.examples/anddocs/05-parking-garage/.🤖 Filed by Claude Code