Here’s a one-liner for converting angle brackets and other characters that need escaping. This will work on any system that has Python installed. Run this command:
python -c 'import cgi; import sys; print cgi.escape(sys.stdin.read())' | pbcopy
Once you hit enter on the command above, paste the content to convert and after pasting hit
enter followed by
If you’re not on OS X, remove the pipe to
pbcopy. If you are on OS X, your converted text is now in your clipboard!