feat(search): add minHeading/maxHeading options#3636
Conversation
|
@onmax is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
|
I like the idea about separator but I'm not sure how useful it could be because by default other elements do not have |
|
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 Should I add a note about this in the documentation, or should we only allow headings in the separator option? |
|
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. |
8b0ede9 to
3c0b97e
Compare
|
updated the pr. changed api from the array approach allowed weird combos like |
| } | ||
|
|
||
| export function queryCollectionSearchSections(event: H3Event, collection: keyof Collections, opts?: { ignoredTags: string[] }) { | ||
| export function queryCollectionSearchSections(event: H3Event, collection: keyof Collections, opts?: { ignoredTags?: string[], separators?: string[] }) { |
There was a problem hiding this comment.
I think there is a discrepancy here between the docs and the implementation
The documented api is { minHeading: 'h2', maxHeading: 'h3' }
Adds
minHeadingandmaxHeadingoptions to filter which heading levels create new sections.Default:
h1toh6(backward compatible)