google-code-prettify

Google provides many tools to aid web development. One such tool for code snippet beautification is known as google-code-prettify or prettify. It provides basic syntax highlighting for code in various languages including:

bash, c, cc, c++, c#, c shell, CycL, cv, htm, html, java, javascript, matlab, mxml, perl, pl, pm, python, ruby, shell, xhtml, xml, xslt

Usage

Add the css and javascript to the document, preferably in the footer to help load times:

Run the javascript in the HTML. Google suggest doing this with onload in the bodytag:

Include a prettyprint class either as a prepending pre tag or within the code tag itself:

Comments are closed.

Search

Websites

  • slide
  • slide
  • slide
  • slide