Skip to content

Group a slide's entrance with its own heading in the Table of Contents - #273

Merged
panglesd merged 2 commits into
panglesd:mainfrom
RyanGibb:fix-toc-slide-grouping
Sep 3, 2026
Merged

Group a slide's entrance with its own heading in the Table of Contents#273
panglesd merged 2 commits into
panglesd:mainfrom
RyanGibb:fix-toc-slide-grouping

Conversation

@RyanGibb

Copy link
Copy Markdown
Contributor

This slipshow file reproduces the issue:

{#first pause slip}
> # First
>
> a
>
> {#first-a pause}
> b

----

{#second pause slip}
> # Second
>
> c
>
> {#second-a pause}
> d

Previously the #second pause was listed under the 'First' section in the ToC. Now it's the first entry under the 'Second' section in the ToC.

This was programmed with claude code.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 1815c051-8dc4-4712-b1cc-ab470760ca34

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce80a7 and 65a1481.

📒 Files selected for processing (1)
  • src/engine/runtime/table_of_content/table_of_content.ml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/engine/runtime/table_of_content/table_of_content.ml

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The TOC generator recursively detects when an action opens with a title and moves that title before the action. categorized_els now applies this preprocessing. The changelog records the grouping of each slide’s entrance with its heading.

Merge Risk: ⚪ Minimal · up to 65a14

The TOC update groups each slide entrance pause with its own heading. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: grouping each slide's entrance with its own heading in the Table of Contents.
Description check ✅ Passed The description explains the reproduced issue and the corrected Table of Contents behavior, which directly matches the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@panglesd panglesd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good hoisting, thanks! There is something to fix though.

You can add a changelog entry!

title. Hoist such a title above the action that contains it, so a slide's
entrance is grouped with its own heading. *)
let rec hoist_contained_titles = function
| (`Action a as action) :: `Title t :: rest when Brr.El.contains a ~child:t ->

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the when clause should be:

When the first child of a is t

Otherwise:

{pause}
> Blablabla
>
> Something something
>
> # First title but after some content

would put the pause after the title!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! I didn't think of this case :-)

@RyanGibb
RyanGibb force-pushed the fix-toc-slide-grouping branch from 3fdad8e to e5a8751 Compare August 26, 2026 21:14

@panglesd panglesd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I still have some changes! If you prefer, I can take over the PR, just let me know.

A changelog entry is missing too!

Comment thread src/engine/runtime/table_of_content/table_of_content.ml Outdated
Comment thread src/engine/runtime/table_of_content/table_of_content.ml Outdated
Comment thread src/engine/runtime/table_of_content/table_of_content.ml Outdated
heading is nested under .slip/.slip-body, hence the walk down first children. *)
let same el el' = Jv.equal (Brr.El.to_jv el) (Brr.El.to_jv el') in
let rec opens_with a ~title =
match Brr.El.children ~only_els:true a with

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ~only_els:true? Is it to avoid whitespace text elements?

Because I also would prefer not having a hoist in the following case:

<div pause>Some text<h1>title</h1></div>

even though title is the first child element...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, what about something like:

  let blank el =
    Brr.El.is_txt el && Jstr.is_empty (Jstr.trim (Brr.El.txt_text el))
  in
  let rec opens_with a ~title =
    match List.filter (Fun.negate blank) (Brr.El.children a) with

?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 90247ba0-355e-42fc-86d7-ee6fb473fd3f

📥 Commits

Reviewing files that changed from the base of the PR and between e5a8751 and a632dea.

📒 Files selected for processing (1)
  • src/engine/runtime/table_of_content/table_of_content.ml

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread src/engine/runtime/table_of_content/table_of_content.ml Outdated
Co-authored-by: Paul-Elliot Anglès d'Auriac <peada@free.fr>
@RyanGibb
RyanGibb force-pushed the fix-toc-slide-grouping branch from a632dea to 2ce80a7 Compare September 1, 2026 12:33
@RyanGibb

RyanGibb commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestions! There's a lot of edge cases here :-) I think the current diff exhibits the correct behaviour for this file:

{#first pause}
> # First
>
> a
>
> {#first-a pause}
> b

{#second pause}
> # Second
>
> c
>
> {#second-a pause}
> d

{pause}
>
> e
>
> # Third
>
> {pause}
>
> f

{pause}
> {pause}
> # Fourth

{pause}
> g
> > {pause}
> > # Fifth

<div pause>h<h1>Sixth</h1></div>

@panglesd

panglesd commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Thanks a lot! I pushed an ocamlformatting, wait a bit for CI and merge.

@panglesd
panglesd merged commit 0521d1b into panglesd:main Sep 3, 2026
9 checks passed
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