Import markdown to Onenote

Solution 1:

NoteNighlight!

You have to turn on Markdown in the ribbon.xml config (see bottom of link), open a text editor in admin mode to edit the file, and turn the tag to 'true'.

Solution 2:

You might be able to automate something with PanDoc. It can accept MarkDown (among other things) and convert it to many other formats, including some that OneNote might understand, like HTML. It's mostly command-line, so a quick batch file might be in order.

pandoc "%~1" -o "temp.html"
pause
del "temp.html"

With PanDoc and a batch file like that, you can drag and drop a MarkDown file onto the batch file, and a temp.html file will be generated in the source folder. Open it up, copy/paste the results into OneNote.

There are a list of OneNote Command-Line Switches, but they're for OneNote 2007, and I couldn't find a similar document for 2010. /paste and /insertdoc either pasted in raw HTML or nothing at all. Opening the temporary HTML file and copying the rendered results into OneNote works for me, but it's a bit of a hassle.

Another thing about pasting into OneNote is that it has never seemed to respect new lines. I always have to go back through large pasted documents and add the newlines back so that it's not all one giant paragraph. I have yet to find a solution for this.

Solution 3:

Do you have the ability to export the MD as HTML? If not, you can use something like Dillinger to do so.

If your code blocks are converted to <pre> or <code> blocks in HTML, you would be able to open the HTML page and copy it into OneNote while keeping the formatting. <pre> and <code> is dropped, however. You can use some simple CSS to style the content of the tags, which I believe will be copied as well.