Malloc
Malloc

Reputation: 16286

Highlighting source code on my blog article

I write articles on my blog and I need to highlight the source code(java, php or whatever) with special colors like here in stackoverflow with the <pre> tag; could you tell me what option should i use in my blog to do so? You can take a look on my blog to see what I mean. Thanks in advance.

Upvotes: 4

Views: 1486

Answers (3)

Dan
Dan

Reputation: 9801

If you use IntellIJ you can export as HTML which is really nice and works for me.

Upvotes: 0

Mdhar9e
Mdhar9e

Reputation: 1376

You can use the Syntax Highliter code to highlight your code in the blog posts. For this you need to install some code in blogger editHtml page you should add the syntaxHighlither code in blogger template.

Afger posting posts in your blog if any html or java code come then you need to convert it escaped code.

Major issue with this method is that all right angle brackets must be HTML escaped, eg all < must be replaced with &lt; This will ensure correct rendering.

Configure SyntaxHighlighter in your blog.

Upvotes: 0

Brandon
Brandon

Reputation: 70002

StackOverflow uses Google Prettify

For the most basic usage, just decorate your pre tags with the PrettyPrint class.

Upvotes: 6

Related Questions