-
Notifications
You must be signed in to change notification settings - Fork 10
Syntax highlighting
Josh Bruce edited this page Aug 27, 2016
·
5 revisions
It is possible to add syntax highlighting to blocks of code within comments you make.
- Three tick marks (```) in a row are translated into
<code><pre>
, which means whitespace is preserved without extra HTML. - Three tick marks followed by a language specifier allows GitHub Markdown to highlight the code.
/**
*
* This is an example using ```JavaScript
*
**/
var HelloWorld = function() { }
HelloWorld.prototype = {
sayHello: function(label) {
return 'Hello ' + label;
}
}
var helloGitHub = HelloWorld.sayHello('GitHub');
console.log(helloGitHub);
// Should result in "Hello GitHub" appearing in your browser's console.
/**
*
* This example uses ```CSS
*
**/
body {
margin: 0;
padding: 0;
background-color: #cccccc;
}
- Mail on MacOS
- Outlook on Windows (not written yet - submit an issue to request - or go ahead and make the page)
- Gmail on the web