UWP: How to Copy Code from PowerShell ISE to OneNote and Maintain Syntax Highlighting?
2019-11-22 08:15
Gem Menu for OneNote UWP provides the ability to paste rich text to OneNote for Windows 10.
In many cases, OneNote will remove text format when you copied and pasted text , including: text color, background color, some space are removed.
And these text formats are not in HTML format, they may be rich text format.
Lead to the original formatted text, beyond recognition.
Here's an example with the PowerShell ISE that comes with Windows.
In many cases, OneNote will remove text format when you copied and pasted text , including: text color, background color, some space are removed.
And these text formats are not in HTML format, they may be rich text format.
Lead to the original formatted text, beyond recognition.
Here's an example with the PowerShell ISE that comes with Windows.
{C}
Copy Code Highlighted with Syntax from PowerShell ISE
We copy the code in the PowerShell ISE that comes with Windows.
These codes appear to be colored. It is easy to distinguish between variable names and strings.
We copy the code in the PowerShell ISE that comes with Windows.
These codes appear to be colored. It is easy to distinguish between variable names and strings.
Code Loses Color After Pasted to OneNote
In OneNote for Windows 10, press Ctrl + V to paste the PowerShell code and you'll find that all the colors in the code are gone.
In OneNote for Windows 10, press Ctrl + V to paste the PowerShell code and you'll find that all the colors in the code are gone.
Use the Paste Rich Text Feature of Gem Menu to Keep the Color of the Code
To keep the color of your code, you can use the Paste Rich text feature of the Gem Menu.
Click Gem Menu for OneNote UWP -> “Edit” menu -> “Paste Rich Text” menu item.
To keep the color of your code, you can use the Paste Rich text feature of the Gem Menu.
Click Gem Menu for OneNote UWP -> “Edit” menu -> “Paste Rich Text” menu item.
And, the PowerShell code pasted into the OneNote UWP maintains the original syntax highlight color.
The background color will even be preserved.
Demonstration
The background color will even be preserved.
Demonstration