File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " vocs " : minor
3+ ---
4+
5+ Added ` topNav.match ` function
Original file line number Diff line number Diff line change @@ -12,7 +12,12 @@ function getActiveNavIds({
1212 const matches : { id : number ; children : number [ ] } [ ] = [ ]
1313
1414 for ( const item of items ) {
15- if ( item . link && path . startsWith ( item . match || item . link ) )
15+ if (
16+ item . link &&
17+ ( typeof item . match === 'function'
18+ ? item . match ( path )
19+ : path . startsWith ( item . match || item . link ) )
20+ )
1621 matches . push ( { id : item . id , children : [ ] } )
1722 else if ( item . items ) {
1823 const activeChildItems = getActiveNavIds ( { items : item . items , pathname } )
Original file line number Diff line number Diff line change @@ -610,7 +610,7 @@ export type TopNavItem<parsed extends boolean = false> =
610610 }
611611 | ( {
612612 element ?: never
613- match ?: string
613+ match ?: string | ( ( path : string ) => boolean )
614614 text : string
615615 } & (
616616 | { link : string ; items ?: never }
You can’t perform that action at this time.
0 commit comments