Skip to content

Commit 681a581

Browse files
committed
Preserve count order in numbered lists
1 parent 422498e commit 681a581

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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)