Q:

Pasting code from gist to OneNote 2013 places extra newlines. How to solve?

Pasting code from github gists inserts extra newline to OneNote. 
//--------------------------------------------------

// constexpr and Constant Expressions
 

const int flies = 20;         // OK

const int limit = flies+1;    // OK

int staff_size = 27;          // NOT a constant expression (no const)

const int sz = get_size();    // Not a constant expression, get_size() not known until runtime

I want it to look like this:
//--------------------------------------------------
// constexpr and Constant Expressions
 
const int flies = 20;         // OK
const int limit = flies+1;    // OK
int staff_size = 27;          // NOT a constant expression (no const)
const int sz = get_size();    // Not a constant expression, get_size() not known until runtime

Manually deleting newlines is not an option. How can I do this?

A:

One of the solutions is to do as follows:

Copy the code from the gist and paste it to Microsoft Word first, then copy from there and paste it to OneNote. Also works for code from Visual Studio.

