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

feat: add numbers to ordered list item #19

Closed ShubhamVerma1811 closed 2 years ago

ShubhamVerma1811 commented 2 years ago

This PR aims to fix #18 .

I have a created a class variable that would act as counter for ordered list. The implementation of this is open for discussion.

It does not support nested

    with numbers like

    1. A
    2. B
      a.  Sub B
souvikinator commented 2 years ago

Hey, thanks for the contribution. Works as expected however as you mentioned it doesn't support nested lists. The current implementation uses a counter, I guess we can accomplish the nested numbering recursively.

souvikinator commented 2 years ago

Probably by adding a new argument to blocksToMarkdown. If a block has nesting then we can pass a new instance of the counter with the initial value 1 to blocksToMarkdown and it gets incremented. This is a very vague idea so I'm not sure if it'll work but I'll share an example snippet shortly to make things clear.

ShubhamVerma1811 commented 2 years ago

Right, I got the gist of what you are saying.. Let me try something along those lines.

ShubhamVerma1811 commented 2 years ago

Been busy with work, will continue to look into this issue

souvikinator commented 2 years ago

Fixed in #38