Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 tag to display syntax highlighting

I was wondering if there was a tag that auto-highlights the syntax of HTML and or PHP in HTML5. I'm writing a guide that has some code in it. Since I'm using a lot of the new html5 tags (I use section for the outline of my guide) I would like to use something in native html5.

If this does not exist, what is the best way to do this? (Like, PHP and CSS?)

like image 670
Tim van Dalen Avatar asked Dec 29 '22 07:12

Tim van Dalen


1 Answers

There's nothing like that in HTML5 I am afraid, but you can always use highlight_string() from PHP. If you want something purely on the client side, try a JS highlighter like prettify, which is what StackOverflow uses for their code highlighting:

http://code.google.com/p/google-code-prettify/

Here are some other ones:

  • SyntaxHighlighter
  • SHJS (uses GNU Source-highlight definitions)
like image 103
NullUserException Avatar answered Jan 12 '23 20:01

NullUserException