How to write code in C#, Asp.Net, Php, Javascript, C. On this blog you will find example codes that will help you to understand concepts of programming.
Monday, January 2, 2012
How to insert embedded code into a post on Blogger?
As I have just started to write in this blog 3 days ago I came to an issue: how to insert highlighted code, snippets of code: csharp, javascript, css, sql, cpp, python, ruby, xml or perl.
I googled a little and found this solution:
Go to Dashboard page of your blog and go to Template -> Edit HTML -> Proceed. Then just before closing of head tag, insert next lines.
As you can see source of codes come from http://alexgorbatchev.com/SyntaxHighlighter/ so you can find last updates right on that blog.
Of course, if you are not going to insert let's say Python code than it won't be necessary no insert that line
()
Save your template and go to a new post.
There are two possibilities to insert snippets code.
Using script tag
Result is:
Using the pre tag
// Comment
public class Test2 {
public Test2() {
}
public void AMethod() {
/* Another comment */
string var = "Message";
}
}
Result is:
// Comment
public class Test2 {
public Test2() {
}
public void AMethod() {
/* Another comment */
string var = "Message";
}
}
No comments:
Post a Comment