Simple head over to http://gist.github.com/, paste your code snippet there and select the language, then select "create public gist". On the next page, click on "embed" and it becomes a JavaScript snippet. Just embed it in your page and you are done!
No need to change Blogger template and no need to understand the configuration and syntax of SyntaxHighlighter ;-)
Here is a quick example:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Equality</title> | |
<script type = "text/javascript"> | |
var x = 42; | |
var y = "42"; | |
if (x ===y) { | |
document.write("x is equal to y with a strict test."); | |
} else { | |
document.write("x is not equal to y"); | |
} | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
I am having tough time having to get syntax highlighting work. I posted a java gist here - https://gist.github.com/1399748 but it looks all black text. How did you get color highlight in your case?
ReplyDeleteHi, Tarun
ReplyDeleteI guess you forgot to specify the "Language" when you create the gist and instead used the default plain text?
Another option is that you can also give a file name like foo.java and the syntax will be automatically detected.
Here is the gist with your code: https://gist.github.com/1403646