Skip to content

Put each code fold inside its language tab - #296

Merged
d-morrison merged 2 commits into
mainfrom
claude/project-thread-sswd45
Oct 31, 2026
Merged

d-morrison merged 2 commits into
mainfrom
claude/project-thread-sswd45

Conversation

@d-morrison

Copy link
Copy Markdown
Contributor

Requested by Ezra · project thread

Quarto hoists a cross-referenced figure's details.code-fold blocks above the figure, so the R and Python folds stacked outside the tabset (example: https://morrison-lab.github.io/mds/optimization-convexity.html#fig-convex-set).

This adds tabset-code-in-tabs.html, an after-body script that moves each fold into the tab for its language, matching by language and falling back to order. It skips a tabset unless the folds before it equal its tab count. .gitignore gets an exception for the new file, as for the other includes. The fold labels here already say "Show code".

Checked with jsdom on the published mds page; the PR preview should confirm it in a real render.


Generated by Claude Code

Quarto hoists a figure's code folds above the figure, so R and Python
folds stacked outside the tabset. A small after-body script moves each
fold into the tab for its language, and the fold label no longer says R.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9pT9FcXoVbp61GC7NJ
@d-morrison d-morrison self-assigned this Oct 30, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

The slide tabsets use tabby markup, so the script now selects panes and
tabs without Bootstrap class names, and a fold with no language match
takes the first unused tab.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9pT9FcXoVbp61GC7NJ
@github-actions

Copy link
Copy Markdown
Contributor

Claude finished review — View run


A live fetch of PR 296 just now shows it open and not merged, with head d9a8a44c1c9d25a84688aa67db75df8ed0489566. That is the commit I reviewed.

Review of #296 at d9a8a44

My earlier review (#296 (comment)) was Ready for merge at e1ebf41, and it still stands. The one new commit, d9a8a44 ("Move code folds into tabs on slides too"), touches _quarto-website.yml and tabset-code-in-tabs.html. I read the diff and did not render the site or slides, because Quarto is not installed here.

  • _quarto-website.yml: adds include-after-body: tabset-code-in-tabs.html to the revealjs format. The key is valid, and the partial is already whitelisted in .gitignore.
  • tabset-code-in-tabs.html:46-51: the earlier fallback suggestion is fixed. A fold with no language match now takes the first unused pane, so two folds can no longer land in one pane.
  • tabset-code-in-tabs.html:17: the guard now also requires tabs.length === panes.length, which keeps unused() from returning a stale or missing index.
  • tabset-code-in-tabs.html:10-11: the selectors are loosened to :scope > .tab-content > div and :scope > ul > li > a, so they can match slide markup.

Suggestions (non-blocking):

  • tabset-code-in-tabs.html:10: :scope > .tab-content > div assumes the slide tabsets also wrap their panes in .tab-content. I could not confirm that. If revealjs tabby tabsets put the pane divs directly under .panel-tabset after the <ul>, panes is empty. The folds.length !== panes.length guard then silently skips every slide, and the feature does nothing there. Please render one slide deck and check that a fold ends up inside its tab. If it doesn't, query :scope > .tab-content > div, :scope > div[id^="tabset-"] instead.
  • tabset-code-in-tabs.html:15: in the reveal case, check that Quarto's details.code-fold hoisting and the quarto-float wrapper exist on slides. The previousElementSibling walk depends on them.
  • tabset-code-in-tabs.html:22-24: the language is still taken from the first class that isn't in the exclusion list. This is the same non-blocking point as last round.

No math, definitions, or prose changed, so the macro and definition-div checks don't apply.

Verdict

Ready for merge

Structured Review Data (JSON)
{
  "schema_version": "1.1",
  "reviewer": "claude",
  "commit_sha": "d9a8a44c1c9d25a84688aa67db75df8ed0489566",
  "verdict": "CLEAN",
  "findings": [],
  "detailed_assessment": "In tabset-code-in-tabs.html the fallback index now picks the first unused pane and the guard checks tab and pane counts. The loosened selectors are unverified against revealjs tabby markup, which is a non-blocking concern.",
  "holistic_assessment": "The revealjs include-after-body addition is scoped to slides, and the partial is already whitelisted in .gitignore. No CI or build-hygiene regressions were found. Slide rendering was not verified because Quarto is unavailable here."
}

Stopping Point: Clean stopping point reached --- session done; UMS executed; no follow-up items pending

Reviewed commit: d9a8a44

@github-actions

Copy link
Copy Markdown
Contributor

💰 Cost: $0.2286 (review) — run

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.

2026-10-31 00:27 UTC

@d-morrison
d-morrison merged commit d1e37be into main Oct 31, 2026
34 checks passed
@d-morrison
d-morrison deleted the claude/project-thread-sswd45 branch October 31, 2026 00:27
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