Skip to content

Commit 05fc72a

Browse files
authored
Merge pull request #6 from splitbee/fix-numbered-list
Preserve count order in numbered lists
2 parents 25f60c3 + 681a581 commit 05fc72a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: src/block.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ export const Block: React.FC<Block> = props => {
9191
case "bulleted_list":
9292
case "numbered_list":
9393
const isTopLevel = block.value.type !== parentBlock.value.type;
94-
94+
const itemPosition =
95+
1 + (parentBlock.value.content?.indexOf(block.value.id) || 0);
9596
const wrapList = (content: React.ReactNode) =>
9697
blockValue.type === "bulleted_list" ? (
9798
<ul className="notion-list notion-list-disc">{content}</ul>
9899
) : (
99-
<ol className="notion-list notion-list-numbered">{content}</ol>
100+
<ol start={itemPosition} className="notion-list notion-list-numbered">
101+
{content}
102+
</ol>
100103
);
101104

102105
let output: JSX.Element | null = null;

0 commit comments

Comments
 (0)