File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,8 +50,6 @@ const cleanSlug = (p: string) =>
5050const toPosix = ( s : string ) => {
5151 return posix . normalize ( s . replace ( / \\ / g, "/" ) )
5252}
53- const stripExt = ( s : string ) => s . replace ( / \. ( m d | m d x ) $ / i, "" )
54- const stripTrailingIndex = ( s : string ) => s . replace ( / \/ i n d e x $ / i, "" )
5553
5654/*
5755 * This collection defines a documentation section shown in the sidebar of the package documentation.
@@ -65,7 +63,7 @@ const section = defineCollection({
6563 include : "**/index.md" ,
6664 schema : sectionSchema ,
6765 transform : ( document ) => {
68- const slug = stripTrailingIndex ( cleanSlug ( document . _meta . path ) )
66+ const slug = cleanSlug ( document . _meta . path )
6967 return { ...document , slug }
7068 } ,
7169} )
@@ -81,8 +79,7 @@ const page = defineCollection({
8179 include : "**/**/*.mdx" ,
8280 schema : pageSchema ,
8381 transform : async ( document , context ) => {
84- const rel = cleanSlug ( document . _meta . path )
85- const slug = stripExt ( rel )
82+ const slug = cleanSlug ( document . _meta . path )
8683 const content = await compileMDX ( context , document , { rehypePlugins : [ rehypeSlug ] } )
8784 const rawMdx = document . content . replace ( / ^ - - - \s * [ \r \n ] ( .* ?| \r | \n ) - - - / , "" ) . trim ( )
8885
You can’t perform that action at this time.
0 commit comments