While using Gmail, you sometimes like to send short source code of Java, C#, HTML or any code, etc to your friends then you have first tried to copy the code from your IDE to Gmail directly. When you notice the code, you will find the code does not have syntax highlighting, code indentation, loss text format, do not highlight syntax error, miss-spelling, etc. This is not attractive and recipients feel bore looking at the code. So, you try to bold, italic certain parts of the code to make it look better but it is a tedious task. Then you will search on the internet and you may get articles like this.
In this article, I will guide you on how to format code in Gmail easily. There are various ways of achieving them, let's explain them one by one.
Method 1: Using Website
You can format your code with the help of some website like tohtml.com and then paste the formatted code in Gmail.
Paste your code under HTML Code: text box.
Select Style for the Code
Select the programming language of the code.
Click on the Highlight button.
Click on the "Copy to Clipboard" button.
Open Gmail and Paste it.
Click on the Send button to send.
Method 2: Using Browser Extension
There are many browser extensions like MarkDown Here, CodeHighlight, Syntaxtic helps in formatting code in Gmail.
Method 3: Using Application
Some applications like VS Code can help you to format code in Gmail.
Visual Studio Code:
Visual Studio Code is a code editor available for Windows, macOS, Linux and used by the programmer, especially for frontend development. If you are using visual studio code then you can simply copy the code from visual studio code and paste it in Gmail, then it will automatically highlight the code.
Ans: You can follow above mention ways for highlighting raw HTML in Gmail. For HTML we also have another way. For this just open a text editor and paste HTML code and save it with .html extension and open that file in a web browser. Then just copy the contents of that page and it will automatically copy that content as text/Html and go to the email body and paste it. You will get formatted code in Gmail