Skip to content

Instantly share code, notes, and snippets.

View jpvanoosten's full-sized avatar
🤓
Adding AFR to DX12 Framework.

Jeremiah van Oosten jpvanoosten

🤓
Adding AFR to DX12 Framework.
View GitHub Profile
@jpvanoosten
jpvanoosten / Convert C++ to HTML.py
Created May 31, 2021 21:05
Using the Notepad++ Python Script plugin, you can use Python to perform complex editor operations with a single button. This script replaces the '<' and '>' characters with the HTML equivalents to enable copy-pasting source code into HTML.
# First we'll start an undo action, then Ctrl-Z will undo the actions of the whole script
editor.beginUndoAction()
selectionLength = editor.getSelectionEnd() - editor.getSelectionStart()
start = editor.getSelectionStart() if selectionLength > 0 else 0
end = editor.getSelectionEnd() if selectionLength > 0 else editor.getLength()
# editor.replace("&", "&amp;", 0, start, end)
editor.replace("<", "&lt;", 0, start, end)