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

Syntax Highlightighting

As a developer, I would like to have code snippets in one note. It would be great if I can have syntax highlighting. Can be retaining while copy-pasting from an IDE or something like select the code and apply syntax highlighting in language of your choice

38 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Sandeep Chawla shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    Completed  ·  OneNote API Team Admin responded  · 

    Hello
    We recently overhauled the API handling of

     tags. If you provide code under 
     tags, we will preserve original formatting. 
    The OneNote Web Clipper in Article mode is already using this feature. So any article clipped from a url containing code samples, should preserve original formatting in OneNote
    Could you guys try this out and let us know if this solves your ask?

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Lane commented  ·   ·  Flag as inappropriate

        Very nice: This works perfectly in the web client.
        This will be especially useful when away from the desk, and needing to add a snippet. Thanks for making this happen!

        Any plans for this to be rolled in to the installed clients?

      • AdminOneNote API Team Admin (Admin, OneNote Team) commented  ·   ·  Flag as inappropriate

        Hello
        We recently overhauled the API handling of <pre> tags. If you provide code under <pre> tags, we will preserve original formatting.
        The OneNote Web Clipper in Article mode is already using this feature. So any article clipped from a url containing code samples, should preserve original formatting in OneNote
        Could you guys try this out and let us know if this solves your ask?

      • Robin Molnar commented  ·   ·  Flag as inappropriate

        This is very important to me, because I often have to mix code snippets of SQL/ Python/ Java/ .Net on the same page. So, yes, I really need this.

      • Dat AU DUONG commented  ·   ·  Flag as inappropriate

        There is a workaround is to create a new email in outlook, the paste the code then recopy from outlook message (until Microsoft Addressed the Issue).

        You can do the same thing via Windows 8/8.1 in built mail program using the same technique mention above.

      • Lane commented  ·   ·  Flag as inappropriate

        ON would do this well, already, if it would abide by < whitespace > tags in the html in the clipboard. Unfortunately, there doesn't appear to be any movement on that front.

      Feedback and Knowledge Base