Skip to content

Fix misplaced anchors for remark and proof-like divs - #180

Merged
dem-extra1 merged 1 commit into
mainfrom
fix/remark-anchors
Oct 7, 2026
Merged

dem-extra1 merged 1 commit into
mainfrom
fix/remark-anchors

Conversation

@d-morrison

Copy link
Copy Markdown
Contributor

Port div-anchors extension fix from Morrison-Lab/qwt#160 (Morrison-Lab/qwt#159).

Problem

Quarto theorem environments render titles with class .theorem-title, while proof-like environments (proof, remark, solution) render titles with class .proof-title. Previously, div-anchors.js only queried .theorem-title when relocating AnchorJS anchor links inline, causing remark and other proof-like divs to leave the anchor link at the bottom of the div rather than next to the title (for example, at linear-algebra.html#rem-zero-vector-identity).

Solution

  • Support .proof-title alongside .theorem-title in div-anchors.js.
  • In div-anchors.js, trim trailing whitespace from .proof-title (which ends with '. ') so the non-breaking separator and anchor stay attached to the title, and ensure a trailing space separates the anchor from subsequent body content if not already spaced.
  • Add rem and sol aliases and crossref ID prefix matching (rem-, thm-, def-, etc.) to is_theorem_div in both Lua and JS.

Port div-anchors extension fix from Morrison-Lab/qwt#160 (Morrison-Lab/qwt#159).

Quarto theorem environments render titles with class .theorem-title,
while proof-like environments (proof, remark, solution) render titles
with class .proof-title. Previously, div-anchors.js only queried
.theorem-title when relocating AnchorJS anchor links inline, causing
remark and other proof-like divs to leave the anchor link at the bottom
of the div rather than next to the title.

- Support .proof-title alongside .theorem-title in div-anchors.js
- Trim trailing whitespace from .proof-title (which ends with '. ')
  so the non-breaking separator and anchor stay attached to the title,
  and ensure a space separates the anchor from subsequent body content
- Add 'rem' and 'sol' aliases and crossref ID prefix matching (rem-,
  thm-, def-, etc.) to is_theorem_div in both Lua and JS
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Claude finished review — View run


The diff is small and limited to the two files I already reviewed in full — nothing else is touched. This confirms the review is complete.

Summary of findings: none. The PR ports a fix verbatim (byte-for-byte identical diff, confirmed via gh pr diff 160 --repo Morrison-Lab/qwt) from the already-merged upstream Morrison-Lab/qwt#160, which addresses a real, reproducible problem — numerous rem-/sol-/def- divs exist across this repo's content (_subfiles/linear-algebra/_rem-zero-vector-identity.qmd and dozens of others) whose anchors were misplaced before this fix. Both the JS and Lua implementations are internally consistent (same class list, same ID-prefix list, same logic structure), the JS passes a syntax check, and the diff touches only the two vendored extension files — no unrelated scope creep, no build artifacts (_site/, _freeze/), no spell-check/link-check surface, and no R code involved (lab-manual R rules don't apply here). PR description explains the why clearly and matches CLAUDE.md's "Relationship to rme"-style provenance expectations (no internal-lab-provenance text leaked to readers). No prior review comments exist on this PR.

Verdict

Ready for merge

Structured Review Data (JSON)
{
  "schema_version": "1.1",
  "reviewer": "claude",
  "commit_sha": "da87d6bc01aaad4d4509f3e92a664d0293b14742",
  "verdict": "CLEAN",
  "findings": [],
  "detailed_assessment": "Checked _extensions/div-anchors/div-anchors.js and div-anchors.lua line by line; the diff is byte-identical to the already-merged upstream Morrison-Lab/qwt#160 fix, with no divergence or regression introduced during the port.",
  "holistic_assessment": "Scope stays confined to the vendored anchor-placement extension, matches the described bug (rem-/sol- prefixed divs like rem-zero-vector-identity exist throughout chapters), and carries no build-artifact or CI surface risk."
}

Reviewed commit: da87d6b

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

💰 Cost: $0.3780 (review) — run

@dem-extra1
dem-extra1 merged commit 0e23853 into main Oct 7, 2026
16 checks passed
@dem-extra1
dem-extra1 deleted the fix/remark-anchors branch October 7, 2026 06:52
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-07 00:02 PDT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants