Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tag <code>: how to "correct" publish it?

Tags:

html

i'm not sure to explain what i'm looking for.

What's the name of the "source code parser" for publish code, in HTML ? For example, when i write some source code here in stack overflow, system auto-detect the sintax and write "correct" source code in html.

I've noticed that exists the HTML <"code"> tag, but it simply write source code in "courier" font.

So i'm asking you if exists some "external" component that, given a text, parse it out correctly in a HTML page.

Thank you!

like image 977
stighy Avatar asked Jun 05 '10 17:06

stighy


1 Answers

SO uses prettify to syntax highlight the <code> snippets.

Source: Which tools and technologies were used to build the Trilogy?

It is a JavaScript tool that scans a page for code snippets, and colours them on the fly. The downside of this solution is that it doesn't work with JavaScript turned off. Seeing as syntax colouring is not really an essential task, it is arguably a small downside.

like image 120
Pekka Avatar answered Sep 30 '22 20:09

Pekka