File tree Expand file tree Collapse file tree 4 files changed +6
-4
lines changed
components/modules/table-content Expand file tree Collapse file tree 4 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 1- import type { HeadingGroup } from '@/lib/mdx/utils/extract-tittles ' ;
1+ import type { HeadingGroup } from '@/lib/mdx/utils/extract-titles ' ;
22
33export interface TableContentSubitem {
44 text : string ;
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ export function getHeadings(source: string): HeadingGroup[] {
1515
1616 return headingLines . map ( raw => {
1717 const text = raw . replace ( / ^ # # # * \s / , '' ) ;
18- const level = raw . slice ( 0 , 3 ) === '###' ? 3 : 2 ;
18+ const level = (
19+ raw . split ( '' ) . findIndex ( char => char !== '#' ) || 6
20+ ) as HeadingGroup [ 'level' ] ;
1921
2022 return { text, level } ;
2123 } ) ;
Original file line number Diff line number Diff line change 11import { join } from 'path' ;
22
3- import { extractHeadingsFromMDX } from './extract-tittles ' ;
3+ import { extractHeadingsFromMDX } from './extract-titles ' ;
44import { groupByLevel } from './group-by-level' ;
55import { formatLinks } from './groups-to-links' ;
66
Original file line number Diff line number Diff line change 1- import type { HeadingGroup } from './extract-tittles ' ;
1+ import type { HeadingGroup } from './extract-titles ' ;
22
33export interface HeadingGroupWithSubItems extends HeadingGroup {
44 subItems : HeadingGroup [ ] ;
You can’t perform that action at this time.
0 commit comments