How can we improve the OneNote APIs and developer platform? Vote for an existing idea or share a new one.

A simple way to Code Syntax HIghlight...No extension required !

I was searching for any extension that can help me format my code on my OneNote Mac, but I failed. Now finally I discovered a way to do it.
If you want to paste a code from any source into your onenote with all the syntax and formatting highlight intact, heres a simple solution.
Here's the trick:

Visit the stack overflow site and in the reply section, paste your code in the CODE block, after this stackoverflow will show you the preview of your code in Syntax highlighted manner.
Now just code from the preview and paste in OneNote.....DONE !!
OneNote now shows the exact code snippet as that of the StackOverflow after pasting.

This worked for me, hope this helps.

90 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Nikhil Parmar shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • AndyT commented  ·   ·  Flag as inappropriate

    dude. there are much easier ways.

    Best for me is Visual Studio Code. It's free. It might be better than onenote for your purposes.

    Turn on right text copy/pasting and it'll paste exactly as you see. Colors and all.

Feedback and Knowledge Base