Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Dec 9, 2025

Adds minHeading and maxHeading options to filter which heading levels create new sections.

queryCollectionSearchSections('docs', { minHeading: 'h2', maxHeading: 'h3' })

Default: h1 to h6 (backward compatible)

@vercel
Copy link

vercel bot commented Dec 9, 2025

@onmax is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 9, 2025

npm i https://pkg.pr.new/@nuxt/content@3636

commit: af97701

@atinux atinux requested a review from farnabaz December 10, 2025 09:21
@farnabaz
Copy link
Member

I like the idea about separator but I'm not sure how useful it could be because by default other elements do not have id attribute. The only way to achieve it for hr is

Paragraph

::hr{#my-id}
::

Paragraph

@onmax
Copy link
Contributor Author

onmax commented Dec 11, 2025

Good point. In my personal needs, the main use case is customising which heading levels trigger a new section (e.g. 'h2' or 'h3' rather than all headings).

Adding support for any component, like hr, is just an added bonus, providing flexibility; users who want it can add IDs via MDC syntax.

Should I add a note about this in the documentation, or should we only allow headings in the separator option?

@farnabaz
Copy link
Member

I think headers should be enough. Let’s face it: if you want to create a section, you need a title. What’s the purpose of a section without a title and proper link? In my view, if it doesn’t have a title, it’s most likely a continuation of the previous section.

So I'll go with headers only option.

@onmax onmax force-pushed the feat/search-sections-separators branch from 8b0ede9 to 3c0b97e Compare December 12, 2025 12:00
@onmax onmax changed the title feat(search): add separators option to queryCollectionSearchSections feat(search): add minHeading/maxHeading options Dec 12, 2025
@onmax
Copy link
Contributor Author

onmax commented Dec 12, 2025

updated the pr. changed api from separators: string[] to minHeading/maxHeading.

the array approach allowed weird combos like ['h2', 'h4'] skipping h3. range-based is cleaner and self-documenting - you know exactly what headings will split sections

Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Thanks

@farnabaz farnabaz merged commit 8053ae7 into nuxt:main Dec 15, 2025
4 of 5 checks passed
@onmax onmax deleted the feat/search-sections-separators branch December 15, 2025 18:07
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