I have a lot of notes in markdown that I would like to import to Onenote. Onenote does a bit of conversion but breaks when code blocks are added. Is there a setting where I can tweak how Onenote interprets markdown ?

  • How are you importing the markdown into onenote? Copy and paste? Or actual importing? In what way are code blocks breaking? May 13 '14 at 18:38
  • Copy- paste, It shows code blocks as regular text and everything below it is indented one tab space to the right. with multiple code blocks it gets crazy pretty quickly
    – Shekhar
    May 17 '14 at 1:59
  • I did an export to Onenote but that exports it as image and its not editable
    – Shekhar
    May 17 '14 at 2:00
  • @GonçaloPeres龚燿禄: Why the bounty? Doesn't the answer below work for you and which version of OneNote?
    – harrymc
    Mar 5 at 11:14
  • @harrymc I have stated it in the bounty section: "I am looking for a more recent add-in or for [other] alternative[s] to add mark-down code snippets to OneNote." Mar 5 at 12:45


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'.

  • 1
    Thank you. Reading the docs always helps, but I wouldn't have stumbled upon this feature (I already had it installed) without your answer.
    – dgo
    Oct 16 '19 at 13:51

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"
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.


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.



It seems to work as requested


It converts files from one markup format into another.

The opposite

Using pandoc you can even do the opposite...

ForEach ($result in Get-ChildItem | select Name, BaseName) { pandoc.exe -f docx -t markdown_strict -i $result.Name -o "$($result.BaseName).md" --wrap=none --atx-headers }
  • markdown-strict is the type of Markdown. Other variants exist in the Pandoc documentation
  • --wrap=none ensures that text in the new .md files doesn't get wrapped to new lines after 80 characters
  • --atx-headers makes headers in the new .md files appear as # h1, ## h2 and so on

Or use scripts from github...

  • just saw that onenotegem was created by James Linton. Do you happen to know if it is this James Linton? Mar 9 at 12:18
  • 1
    Not really.... do you refer to this one? Always if it is not a fake account... ;-).
    – Hastur
    Mar 9 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.