SjoerdV / 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!
GNU General Public License v3.0
196 stars 113 forks source link

title: 'Convert OneNote to MarkDown' author:

Convert OneNote to MarkDown

Summary

!!! question 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 PowerShell script 'ConvertOneNote2MarkDown.ps1' will utilize the OneNote Object Model on your workstation to convert all OneNote pages to Word documents and then utilizes PanDoc to convert the Word documents to Markdown (.md) format. It will also:

Known Issues

  1. Password protected sections should be unlocked before continuing, the Object Model does not have access to them if you don't
  2. Section Groups on the first level are listed but are ignored. Nested Section Groups are not processed at all.
    • Recommendation: if you make heavy use of (Nested) Section Groups you first have to reorganize in a way that they are out of the picture. Usually creating a new Notebook named the same as your Section Group and moving all relevant Sections.
  3. You should start by 'flattening' all pen/hand written elements in your OneNote pages. Because OneNote does not have this function you will have to take screenshots of your pages with pen/hand written notes and paste the resulting image and then remove the scribblings. If you are a heavy 'pen' user this is a very cumbersome. If you have an automated solution for this, please let me know
  4. Relative paths can not be used as input for the target folder. Always use an absolute path (ex. 'c:\temp\notes').
  5. This script uses only absolute paths internally, mainly because pandoc on Windows has trouble processing relative paths and for consistency. This will not be changed.
  6. While running the conversion OneNote will be unusable and it is recommended to 'walk away' and have some coffee as the Object Model might be interrupted if you do anything else.
  7. Linked file object in .md files are clickable in VSCode, but do not open in their associated program, you will have to open the files directly from the file system.
  8. Anything I did not catch... please submit an issue.

Requirements

Installation

Clone this repository to acquire the PowerShell script.

Usage

  1. Start the OneNote application. All notebooks currently loaded in OneNote will be converted

  2. Open a PowerShell terminal and navigate to the folder containing the script and run it:

    '.\ConvertOneNote2MarkDown.ps1'
  3. It will ask you for the path to store the markdown folder structure. Please use an empty folder.

    Attention: use a full absolute path for the destination

  4. Sit back and wait until the process completes

Results

The script will log any errors encountered at the end of its run, so please review, fix and run again if needed. If you are satisfied check the results with a markdown editor like VSCode. All images should popup just right in the Preview Pane for Markdown files.

Recommendations

  1. I would like to recommend this repository VSCodeNotebook to host your resulting Markdown Notes folder structure. This solution supports encrypting sensitive (markdown) files and works quite nicely.

  2. While working with markdown in VSCode these are the extensions I like using:

        .\code `
        --install-extension davidanson.vscode-markdownlint `
        --install-extension ms-vscode.powershell-preview `
        --install-extension jebbs.markdown-extended `
        --install-extension telesoho.vscode-markdown-paste-image `
        --install-extension redhat.vscode-yaml `
        --install-extension vscode-icons-team.vscode-icons `
        --install-extension ms-vsts.team

    NOTE: The bottom three are not really markdown related but are quite obvious.

  3. Interesting forks have been developed you might want to take a look at. Especially the one for an Obsidian target made by @rab-bit.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[1.0.0] - 2019-05-19

Added
Changed
Removed

Credits