diff --git a/packages/notion-types/src/block.ts b/packages/notion-types/src/block.ts index ff699677..06628b4a 100644 --- a/packages/notion-types/src/block.ts +++ b/packages/notion-types/src/block.ts @@ -193,6 +193,9 @@ export interface BulletedListBlock extends BaseTextBlock { export interface NumberedListBlock extends BaseTextBlock { type: 'numbered_list' + format?: BaseTextBlock['format'] & { + list_start_index?: number + } } export interface HeaderBlock extends BaseTextBlock { diff --git a/packages/react-notion-x/src/utils.ts b/packages/react-notion-x/src/utils.ts index c4025727..4358b34c 100644 --- a/packages/react-notion-x/src/utils.ts +++ b/packages/react-notion-x/src/utils.ts @@ -45,7 +45,11 @@ export const getListNumber = (blockId: string, blockMap: BlockMap) => { return } - return group.indexOf(blockId) + 1 + const groupIndex = group.indexOf(blockId) + 1 + const startIndex = blockMap[blockId]?.value.format?.list_start_index + return blockMap[blockId]?.value.type === 'numbered_list' + ? (startIndex ?? groupIndex) + : groupIndex } export const getListNestingLevel = (