Syntax Highlighting For Code Examples in Web Pages

The google-code-prettify project makes it possible to apply syntax highlighting to code examples in web pages. These notes are based on the Getting Started guide and README.

  1. Include the run_prettify.js script in your page.
  2. Put your code example inside one of the supported elements and give the element the class prettyprint. The script supports the code, pre, and xmp elements.

About Jennifer Phillips Campbell

Software Developer and Medieval Historian
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s