Repository navigation
fix: keep a label on its added equation - #47
benmandrew wants to merge 1 commit into
Conversation
A label after a display equation is parsed as its own block and rendered after the equation's #diff-added wrapper, so it labels the wrapper. Any reference to it then fails with "cannot reference styled". Render the label inside the wrapper, next to the equation.
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🔇 Additional comments: 3
src/render.rs: 2
21-43: LGTM!
115-126: LGTM!tests/integration.rs: 1
221-222: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Use an exact assertion for the rendered equation.
containschecks pass if unrelated output changes elsewhere. The test only checks one fragment of the body. Extract the body after the preamble and compare it withassert_eq!. The comparison then catches unexpected extra or reordered output.As the retrieved learning says, prefer exact assertions such as
assert_eq!over loose containment checks.Source: Learnings
ℹ️ Review info
⚙️ Run configuration
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
59622cad-dc84-4c19-b97c-b550cb490420
📒 Files selected for processing: 2
src/render.rstests/integration.rs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
A label after a changed display equation is parsed as its own block. The output puts it after the
#diff-added[...]wrapper, so the label attaches to the wrapper instead of the equation. Any reference to it then fails with "cannot reference styled". To reproduce, diff these two versions:The render loop now looks at the next result. When a bare label follows an added equation, the label goes inside the wrapper, next to the equation:
#diff-added[$ x = 2 $ <eq-main>]. A smallnext_labelhelper finds the labels that would otherwise be output bare.Summary by CodeRabbit