Skip to content

🐛 Keep target anchors rendered in tab-set and tab-set-code#275

Merged
chrisjsewell merged 1 commit into
mainfrom
brief/07-target-anchors
Jul 12, 2026
Merged

🐛 Keep target anchors rendered in tab-set and tab-set-code#275
chrisjsewell merged 1 commit into
mainfrom
brief/07-target-anchors

Conversation

@chrisjsewell

@chrisjsewell chrisjsewell commented Jul 12, 2026

Copy link
Copy Markdown
Member

Follow-up fixing two bugs found in a retrospective review of #271 (which preserved target nodes but not their anchors):

  1. tab-set: docutils PropagateTargets moves a preceding target's ids onto the tab-item container, which TabSetHtmlTransform destroys (it only copied the rubric's ids) — so href="#my-target" pointed at nothing in HTML. The container's ids are now carried onto the rendered label.
  2. tab-set-code: targets were dropped entirely (asymmetric with tab-set), same broken-anchor result with no diagnostics. They are now preserved identically.

The #271 test passed against the broken output because it asserted target-node survival and refid resolution, but never that any rendered node still carries the id — it now asserts both that and the literal id="…" in the built HTML (verified to fail against unfixed code), plus a new tab-set-code variant.

Also includes the review's docs nit: get_started.md now says the extra MyST extensions need to be added to the myst_enable_extensions snippet shown, rather than implying the snippet already enables them.

Note: the py311-no-myst env fails on this branch's base due to #271's unguarded myst-parametrized tests — that fix is in #274; after it merges this branch rebases cleanly (mid-file edits only).

Validation: tox -e py311, mypy, ruff check/format, docs-furo all green; the strengthened tests confirmed red against unfixed tabs.py.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.08%. Comparing base (70cf79b) to head (dd64f37).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
+ Coverage   89.95%   90.08%   +0.12%     
==========================================
  Files          12       12              
  Lines        1115     1119       +4     
==========================================
+ Hits         1003     1008       +5     
+ Misses        112      111       -1     
Flag Coverage Δ
pytests 90.08% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Follow-up to #271, which preserved target nodes but not their anchors:

- docutils PropagateTargets moves a preceding target's ids onto the
  tab-item container, which TabSetHtmlTransform destroys — copy the
  container's ids onto the rendered label so href targets exist
- tab-set-code dropped targets entirely (asymmetric with tab-set) —
  preserve them the same way
- strengthen the target test to assert a rendered node carries the id
  and that it appears in the built HTML (the previous assertions
  passed against the broken output); add a tab-set-code variant
- get_started: clarify that examples may need extending
  myst_enable_extensions beyond the snippet shown
@chrisjsewell chrisjsewell force-pushed the brief/07-target-anchors branch from 8a4720d to dd64f37 Compare July 12, 2026 14:32
@chrisjsewell chrisjsewell merged commit 9f62c7d into main Jul 12, 2026
25 checks passed
@chrisjsewell chrisjsewell deleted the brief/07-target-anchors branch July 12, 2026 14:41
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