Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gmail Syntax Highlighter

I sent my code to my friend over Gmail but as you guess, the code is not highlighted in Gmail. Is there solution to highlight code that is sent over Gmail?

like image 430
firstthumb Avatar asked Jul 20 '09 06:07

firstthumb


4 Answers

Paste your code to an online (maybe offline) syntax highlighter, like http://tohtml.com/ . Then copy/paste it to gmail & send.

like image 89
Ahmet Kakıcı Avatar answered Oct 18 '22 16:10

Ahmet Kakıcı


consider using gist.github.com

some benefits:

  • you can copy and paste the syntax highlighted code into gmail
    • (its not always perfect but gets the job done, see screenshot below) enter image description here
  • snippet(s) can be shared with a hyperlink (also bookmarkable)
  • you don't need an account to share code snippets
    • code can still be kept private and is only shared with those have the secret link
  • you can specify the language or snippet type, or even multiple snippets on a single page
    • each lang can be specified with github flavored markdown
  • you can also access historical changes of the snippet making it easy to track revisions over time
like image 43
lfender6445 Avatar answered Oct 18 '22 16:10

lfender6445


Unless you absolutely have to have the code in the email, I would just put your code on Pastebin and link to the code.

If you must put your code in the email, you could use a GreaseMonkey script such as this C++ highlighter, however that will not work for the person you're sending it to, only you. Another solution is to export your code as HTML (with coloring), and send it to the person as HTML. Try Visual Studio's CopySourceAsHtml plugin if you're using Visual Studio.

like image 9
Dan Walker Avatar answered Oct 18 '22 18:10

Dan Walker


If your language is not available at http://tohtml.com but you use GitHub you can also paste into a (private) gist there - http://gist.github.com/ - then copy&paste back to gmail.

like image 9
MathiasKegelmann Avatar answered Oct 18 '22 18:10

MathiasKegelmann