theohbrothers / ConvertOneNote2MarkDown

Ready to make the step to Markdown and saying farewell to your OneNote, EverNote or whatever proprietary note taking tool you are using? Nothing beats clear text, right? Read on!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ordered list

sGhadir opened this issue · comments

Bug

Ordered lists from onenote have double spaces after conversion. When looking at the intermediate created doc files, it seems that there is a break after each line. I tried but I have no idea how to solve this. See image:

  1. Onenote:
    image

  2. Intermediate DOCX:
    image
    image

  3. Markdown output:
    image

I have not currently found a way to solve this, and it seems to me that I will have to change all ordered lists to bullet lists before doing the conversion. Is there any way this can be solved so that the lists don't have spaces?

Thanks

commented

sorry, was away a few days. Looking at my past notes that were converted with this script, you are right that there is a newline between ordered-list items. I think this is valid markdown syntax as determined by most markdown linters of various markdown flavors.

EDIT: stale, see next reply

But if you want to remove the extra newline, you will need to use add a regex search and replacement, something like the keepspaces one here. So, add one mor hashtable under that hashtable:

                            if ($config['keepspaces']['value'] -eq 1 ) {
                                @{
                                    description = 'Clear double spaces from ordered lists'
                                    replacements = @(
                                        @{
                                            searchRegex = '\r*\n\r*\n(\s*)[a-zA-Z0-9]+\. '
                                            replacement = "`n`$1- "
                                        }
                                    )
                                }
                            }

Let me open a PR with a unit test to see if this works.

commented

please try out my new PR, hope it works for you. If it works, will merge it to master.

Thank you :) I will try it as soon as I get the chance and get back to you.

commented

sure :)

Sorry for my late reply. This works perfectly thank you very much! You just saved me hours of tedious work

commented

glad to help :)