This OneNote convertor works really well. Followed these installations instructions first: GitHub - 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!
The instructions are clear.
Learned a few things in the process of converting 2.79GB of Microsoft OneNote Files into markdown and linked media files.
Hopefully the following notes will help others looking to do the same thing.
[1] So, thought it might be useful to embed some of the original OneNotes structure into the markdown, so did a few minor edits to the .ps1 script that created a bunch of new tags for each of the following:
ID:
Type: #OneNote-Notebook
NotebookName:
SectionName:
PageName:
Status:
Tags:
Reference: <a link to the .docx file created by the convertor script, so there’s something easy to refer to just in case the converted markdown info is scrambled due to the data complexity contained in the original onenote page>
[2] I had to reconfigure Microsoft Powershell security settings using the following commands.
Then take the following steps to run the Powershell scripts. Note these have been edited and the changes are included below.
1. To view the execution policies
PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> Get-ExecutionPolicy -List
2. To enable powershell to run the script in CurrentUser policy. Disconnect internet before doing this!
PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
3. To run the powershell script
PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> .\ConvertOneNote2MarkDown-v2.ps1
4. To disable powershell to run the script in CurrentUser policy
PS C:\Users\Rohan.000\desktop\OneNote to MarkDown - PowerShell Convertor\ConvertOneNote2MarkDown-master> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
[3] Made some minor edits to the ‘config.ps1’ file and set the following parameters for the conversion. The ‘$mdFileNameAndFolderNameMaxLength = 50’ was the main parameter that needed some trial and error to reduce markdown file names getting cut off.
$dryRun = 1
$notesdestpath = ‘c:\temp\notes’
$targetNotebook = ‘’
$usedocx = 1
$keepdocx = 2
$docxNamingConvention = 1
$prefixFolders = 1
$mdFileNameAndFolderNameMaxLength = 50
$medialocation = 2
$conversion = ‘markdown-simple_tables-multiline_tables-grid_tables+pipe_tables’
$headerTimestampEnabled = 1
$keepspaces = 2
$keepescape = 1
$newlineCharacter = 2
$exportPdf = 1
[4] Made some minor edits the ‘ConvertOneNote2MarkDown-v2.ps1’ script from around line 918 in the script as follows:
$heading += “nID: $( $pageCfg['lastModifiedTime'].ToString('yyyyMMddHHmmss') )" $heading += "nType: #OneNote-Notebook”
$heading += “nNotebookName: #$( $cfg['notebookName'] )" $heading += "nSectionName: #$( $sectionCfg[‘nameCompat’] )”
$heading += "nPageName: $( $pageCfg['nameCompat'] )" $heading += "nStatus: "
$heading += "`nTags: "
$heading += “nReferences:n ![[$( $cfg[‘notebookName’] )/docx/$( $pageCfg[‘id’] )-$( $pageCfg[‘lastModifiedTimeEpoch’] ).docx]]”
$heading += “nn—”