File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ export const AriaDocsCollection = new Directory({
33
33
basePath : "aria-docs" ,
34
34
loaders : {
35
35
mdx : withSchema < DocSchema > (
36
- // {frontmatter: frontmatterSchema},
37
36
( path ) => import ( `@content/docs/aria-docs/${ path } .mdx` ) ,
38
37
) ,
39
38
} ,
Original file line number Diff line number Diff line change @@ -11,6 +11,16 @@ export interface TreeItem {
11
11
children ?: TreeItem [ ]
12
12
}
13
13
14
+ /**
15
+ * Checks if an entry is hidden (starts with an underscore)
16
+ *
17
+ * @param entry {EntryType} the entry to check for visibility
18
+ * @returns {boolean }
19
+ */
20
+ export function isHidden ( entry : EntryType ) {
21
+ return entry . getBaseName ( ) . startsWith ( "_" )
22
+ }
23
+
14
24
/** Create a slug from a string. */
15
25
// source: https://github.com/souporserious/renoun/blob/main/packages/renoun/src/utils/create-slug.ts
16
26
export function createSlug ( input : string ) {
@@ -24,6 +34,9 @@ export function createSlug(input: string) {
24
34
// source:
25
35
// https://github.com/souporserious/renoun/blob/main/packages/renoun/src/file-system/index.test.ts
26
36
async function buildTreeNavigation ( entry : EntryType ) : Promise < TreeItem | null > {
37
+ if ( isHidden ( entry ) ) {
38
+ return null
39
+ }
27
40
if ( isDirectory ( entry ) ) {
28
41
return {
29
42
title : entry . getTitle ( ) ,
@@ -58,7 +71,9 @@ async function buildTreeNavigation(entry: EntryType): Promise<TreeItem | null> {
58
71
}
59
72
60
73
export async function getTree ( sources : EntryType [ ] ) : Promise < TreeItem [ ] > {
61
- return ( await Promise . all ( sources . map ( buildTreeNavigation ) ) ) . filter (
62
- ( ele ) => ! ! ele ,
63
- )
74
+ return (
75
+ await Promise . all (
76
+ sources . filter ( ( ele ) => ! isHidden ( ele ) ) . map ( buildTreeNavigation ) ,
77
+ )
78
+ ) . filter ( ( ele ) => ! ! ele )
64
79
}
You can’t perform that action at this time.
0 commit comments