Search code examples
gmail

How to use code block formatting in gmail (or any other email)?


This question is not very technical, but I am trying to do something specific with formatting code for use in emails. I am trying to email a colleague several command line prompts like the one below:

C:\Users\DOOKIE\Documents\research>hg branches
default                      476:7556c41ee089

I would like to send it in a codeblock, with a grey background similar to the format above. Does anyone know how to do this in Gmail?


Solution

  • I discovered a plug-in (at least for Google chrome) called Markdown that is a lightweight markup language used for formatting text. It is currently used for project communication on GitHub and BitBucket repositories. I am sure there are similar solutions out there, but a browser plug-in like Markdown seems like a good way to go.

    Through the use of tags, I can quote code and scripts, like the one in the above question, into a desired format. Simply adding three backticks (```) before and after any code will create a code block.

    https://markdown-here.com/