What
The `bytes-vs-bytearray` figure on https://www.pythonbyexample.dev/examples/bytes-and-bytearray renders its byte literals with doubled backslashes:
```
b'\x63\x61\x66'
bytearray(b'\x63\x61')
```
The example's own code and output show single backslashes, so the figure contradicts the cell it sits under.
Why
`bytes_vs_bytearray` in `src/marginalia.py` writes the labels as Python string literals with four backslashes (`"b'\\\\x63…'"`). Each pair collapses to one literal backslash, so the rendered text carries two. The grammar then XML-escapes the text correctly, so the doubled characters reach the browser as-is.
Why it shipped
The figure contracts in `tests/test_marginalia_geometry.py` check geometry (clipping, collision, palette, stroke, accent count) but never check label content against the example. Nothing compares a figure's mono text with the cell's code or output.
Fix
- Use two backslashes per escape in the paint strings (or a raw string).
- Add a content contract: no rendered figure text may contain a doubled backslash, and mono labels that contain an escape sequence must appear verbatim in the example's code or output.
What
The `bytes-vs-bytearray` figure on https://www.pythonbyexample.dev/examples/bytes-and-bytearray renders its byte literals with doubled backslashes:
```
b'\x63\x61\x66'
bytearray(b'\x63\x61')
```
The example's own code and output show single backslashes, so the figure contradicts the cell it sits under.
Why
`bytes_vs_bytearray` in `src/marginalia.py` writes the labels as Python string literals with four backslashes (`"b'\\\\x63…'"`). Each pair collapses to one literal backslash, so the rendered text carries two. The grammar then XML-escapes the text correctly, so the doubled characters reach the browser as-is.
Why it shipped
The figure contracts in `tests/test_marginalia_geometry.py` check geometry (clipping, collision, palette, stroke, accent count) but never check label content against the example. Nothing compares a figure's mono text with the cell's code or output.
Fix