souvikinator / notion-to-md

Convert notion pages, block and list of blocks to markdown (supports nesting and custom parsing)
https://www.npmjs.com/package/notion-to-md
MIT License
1.08k stars 90 forks source link

Added support for numbered lists #38

Closed raphtlw closed 2 years ago

raphtlw commented 2 years ago

This fixes issue #18 and even supports nested list items.

In PR #35, I forgot to call the function that takes the blocks and adds the index for the bullet point. This is now fixed.

I solved this problem by introducing a new hook function that runs after each block's children is listed. I then "inject" a new property into the block object number, which just increments from 1 to max, and then in the rendering stage, use the property to render the numbered list bullets.

Result:

Screenshot 2022-06-21 at 2 19 36 AM Screenshot 2022-06-21 at 2 19 53 AM

You can see it in production here

souvikinator commented 2 years ago

Awesome! Now it works. Thanks for the contribution. Should be live in the next release.