Skip to content

Conversation

@maximilianfalco
Copy link
Contributor

PR App Fix CX-2404

🧰 Changes

Sections within custom components are now properly extracted and displayed in the table of contents.

🧬 QA & Testing

  1. Create a custom component with sections
  2. Use the component in a page
  3. The TOC should contain sections defined within that component

Demo

Before

before.mov

After

after.mov

Comment on lines 135 to 140
parentModule.toc.push({
type: 'mdxJsxFlowElement',
name: 'ChildInfo',
attributes: [],
children: [],
} as IndexableElements);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you modifying the toc tree directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this to kind of simulate the run-time behaviour so we can make sure nested component TOCs bubble up exactly the way they do in production. (Im not too familiar with the testing patterns of this repo though, so if theres a better pattern I can implement, pls lmk)

@kellyjosephprice kellyjosephprice merged commit 615fe1b into readmeio:next Nov 11, 2025
2 checks passed
rafegoldberg pushed a commit that referenced this pull request Nov 11, 2025
## Version 11.7.0
### ✨ New & Improved

* migrate contents inside comments ([#1229](#1229)) ([60691dc](60691dc))

### 🛠 Fixes & Updates

* **deps:** bump tailwindcss from 4.1.16 to 4.1.17 ([#1231](#1231)) ([96343ae](96343ae)), closes [#19263](https://github.com/readmeio/markdown/issues/19263) [#19242](https://github.com/readmeio/markdown/issues/19242) [#19263](https://github.com/readmeio/markdown/issues/19263) [#19242](https://github.com/readmeio/markdown/issues/19242) [#19272](https://github.com/readmeio/markdown/issues/19272) [#19263](https://github.com/readmeio/markdown/issues/19263) [#19238](https://github.com/readmeio/markdown/issues/19238)
* empty callouts erroring out ([#1232](#1232)) ([e740bfc](e740bfc))
* extract sections within custom components for TOC ([#1227](#1227)) ([615fe1b](615fe1b))
* skip wrapping heading in callouts for non pragraph ([#1230](#1230)) ([bcb0c0a](bcb0c0a))
* **deps-dev:** upgrading to vitest v4 ([#1222](#1222)) ([4fbaa3e](4fbaa3e))

<!--SKIP CI-->
@rafegoldberg
Copy link
Contributor

This PR was released!

🚀 Changes included in v11.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants