Skip to content

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

Merged
d-morrison merged 1 commit into
mainfrom
fix/remark-anchors
Oct 7, 2026
Merged

d-morrison 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.

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

Claude finished review — View run


Good — the upstream qwt#160 fix was merged just minutes before this port PR was opened. Everything checks out: the port is byte-identical to the merged, verified upstream fix, the ID-prefix conventions it adds (sol-, def-, thm-, etc.) are genuinely used in this repo's content (_sol-loss.qmd, _def-variance.qmd, _thm-lotus.qmd), and the logic for trimming/re-inserting whitespace around the title is sound given how Quarto renders .proof-title and how AnchorJS places its anchor as the div's last child.

No CLAUDE.md, lab-manual, or correctness issues found. This is a pure extension (JS/Lua) change with no .qmd, R, or bibliography content affected, so the Quarto-prose/R-lint/build-hygiene checklist items don't apply here.

Verdict

Ready for merge — faithful, verified port of the upstream Morrison-Lab/qwt#160 fix; no bugs, CLAUDE.md violations, or hallucinated references found.

Structured Review Data (JSON)
{
  "schema_version": "1.1",
  "reviewer": "claude",
  "commit_sha": "a5e284e27b4061ce2674c6d45a98b5400daed550",
  "verdict": "CLEAN",
  "findings": [],
  "detailed_assessment": "Checked div-anchors.js and div-anchors.lua whitespace-trim and prefix-matching logic against real repo content like _sol-loss.qmd and found no failure mode.",
  "holistic_assessment": "Confirmed this port matches the merged upstream qwt#160 fix byte-for-byte, so integration, scope, and regression risk are all minimal."
}

Reviewed commit: a5e284e

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

💰 Cost: $0.7119 (review) — run

@d-morrison
d-morrison merged commit 1aa5d9e into main Oct 7, 2026
15 checks passed
@d-morrison
d-morrison deleted the fix/remark-anchors branch October 7, 2026 07:05
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-07 00:11 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.

1 participant