Repository navigation
Restore numbered section links - #355
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| if (!id) return | ||
|
|
||
| const target = document.getElementById(id) | ||
| const headingId = target?.hasAttribute("data-heading-alias") ? target.closest("h1, h2, h3, h4, h5, h6")?.id : id |
There was a problem hiding this comment.
No test covers the new step that maps a numbered alias in the URL to its heading in the outline. For example, opening #section-4-1 on a heading whose ID is 41-findings must expand the collapsed outline section that holds that heading. The new browser specs in spec/system/references_spec.rb check only that the heading is visible below the sticky header. They do not look at the outline. If this mapping breaks, the alias is not an outline entry, nothing expands, and every test still passes. Add a case next to "unfolds the target of a section link" in spec/system/outline_collapse_spec.rb that visits a numbered alias fragment on a heading with its own ID. Assert that the outline section that holds it is expanded.
| content-mutation broadcast. skip_digest avoids the template-digest cost | ||
| on write paths; expiry picks up renderer changes within 15 minutes. -%> | ||
| <% cache [Coplan::EmbedDomain.order(:hostname).pluck(:hostname), request&.host, "coplan/plan-content-body-with-title", plan.id, plan.current_plan_version&.content_sha256 || plan.current_revision], expires_in: 15.minutes, skip_digest: true do %> | ||
| <% cache [Coplan::EmbedDomain.order(:hostname).pluck(:hostname), request&.host, "coplan/plan-content-body-v2", plan.id, plan.current_plan_version&.content_sha256 || plan.current_revision], expires_in: 15.minutes, skip_digest: true do %> |
There was a problem hiding this comment.
what is this 'v2' thing? this seems like code smell...
| <h2 id="gamma">1. Gamma</h2> | ||
|
|
||
| </section> | ||
| MARKDOWN |
There was a problem hiding this comment.
this feels weird... why do we have HTML as MARKDOWN?
…section-links * origin/main: Reset browser test sessions on Chrome 158
What changed and why
Numbered links such as
#section-3-1lost their scroll target and preview when Commonmarker 2.9 moved the generated slug onto the heading. Coplan now adds a numbered alias when the heading already has an ID, so both fragments reach the same heading. Slides match the full document's numbered aliases, including when more than one slide repeats a section number. The outline opens the target’s branch and direct URLs clear the sticky header. Existing rendered pages refresh when the standard 15-minute cache expires.Commonmarker heading ID change
Evidence
I checked the numbered link in the browser. Focusing §3 opened the “3. Invalidation” preview, and following the link or opening its URL directly landed below the sticky header.
How to try it
Open the demo library and choose Search latency: cutting p95 with a two-tier cache. Hover over §3 in the first paragraph to see the preview, then click it to jump to 3. Invalidation.
Testing
Added browser coverage for previewing and following both fragments, for loading the numbered fragment directly, and for opening the slide that owns a repeated number. The outline spec also checks that an alias opens the target and its parent.
Covered existing IDs, duplicate section numbers, preview markup, and alias alignment across slides.
Ran the 16 reference browser specs with Commonmarker 2.10.0 in an alternate bundle. All passed.
Ran 118 Markdown helper, plan helper, and content editing specs with Commonmarker 2.6.3 and 2.10.0. All passed.
Verified the outline case with both Commonmarker 2.6.3 and 2.10.0. It fails at the target’s outline toggle if alias resolution is removed.
Checked the numbered link in light and dark mode and attached screenshots.
Generated with Codex