theohbrothers/ConvertOneNote2MarkDown

Convert OneNote to Obsidian Markdown - What I did

NAL100 opened this issue · 1 comments

See my other issue, #122 , but here is what I did to convert OneNote to Obsidian notes for reference. This took me hours and hours to troubleshoot so hopefully it will save everyone some time.

I followed the install instructions including using Choco to install but had to run the terminal as admin because the environmental variables didn't get set. Then BOTH visual studio code (run the script within that) AND OneNote need to be opened in Administrator mode. If I didn't run OneNote in administrator mode, it didn't work. For reference, I'm using OneNote 2016 Desktop version.

Now for the part that asks about the pandoc conversion strings, I used this one:
markdown-simple_tables-multiline_tables-grid_tables+pipe_tables-bracketed_spans+native_spans+startnum.

Then I also put to create a new doc file, save the doc files, etc, for troubleshooting. I also put in "255" as the max number of characters to export, not 32. However later I ran into a few files that were too large of file names to sync so had to manually remove them. Then I ran the script and it created the .md files.

You then have to go into Notepad++ or another editor and do mass find and replace across the entire directory. First of all there were some weird comments showing up, so I had to find/replace those to blank. Then I also did find/replace on all images that had appended after them something like {width:xx px, height: xxpx}. To replace those I did a regular expression search in Notepad++ across all the directories, and put in the .* as a wildcard, so {width:.* px, height: .*px}. You have to select regular expression as the search method, NOT case sensitive.

The pandoc conversion strings I listed above will create all underlined text as: **Text Here. However you need to create a separate CSS snippet for that: (See obsidian docs for how to create css snippets)

.underline {
    text-decoration: underline;
}

The other thing I had to find/replace was a ridiculous amount of blank space. So basically I did \n for 15 times: \n\n\n\n etc, and then replaced it with \n\n. Then I did find and replace. And then took off one \n (now 14 times) and did another find and replace. And so on. Time consuming but I didn't know another way of doing it.

I think that's it.

Just wanted to leave a note here to say thanks for your notes about converting to Obsidian. Somehow I missed your issue. I'm adding this to the readme for others who might need help with Obsidian.