fabro/docs
Bryan Helmkamp f932a0763b
refactor(graphviz): simplify stylesheet comment stripping
Replace the hand-rolled byte scanner in strip_css_comments with a
str::find loop over "/*" and "*/".

Drop the quote and backslash tracking. The stylesheet language has no
string literals: parse_declarations ends a value at the first ';' or
'}' with no quote awareness, and values flow into AttrValue::String
verbatim, so a quoted model name is just an unknown model. Tracking
quotes here also created a failure mode the simple scan does not have.
An unpaired apostrophe, as in `model: don't`, disabled comment
stripping for the rest of the input and then blamed a well-formed
comment for the parse error.

Also drop the Cow and its copied_through watermark. They avoided one
allocation on a graph attribute of a few hundred bytes, parsed once per
workflow load, in a function whose caller already clones the attribute
and whose parser allocates a String per property and per value.

Extract excerpt() for the error snippets. The two existing call sites
sliced raw bytes at index 20, which panics when a multi-byte character
straddles the cutoff; model_stylesheet is arbitrary user text, so that
was reachable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 22:16:36 -04:00
..
brainstorms Increase LR graph zoom to 400% and remember zoom per direction (#581) 2026-07-21 16:06:25 -04:00
ideation docs 2026-04-09 17:24:30 -04:00
internal Bound for_each fan-out memory 2026-07-28 20:16:20 -04:00
plans Drop local plan drafts committed by mistake 2026-07-28 20:16:35 -04:00
public refactor(graphviz): simplify stylesheet comment stripping 2026-07-29 22:16:36 -04:00
superpowers Drop local plan drafts committed by mistake 2026-07-28 20:16:35 -04:00