Prettify

Overview

Project lead: Paul Jackson (@pjackson28)

Purpose

Provides syntax highlighting of source code snippets in an HTML page using google-code-prettify.

Implementation

  1. Apply class="wet-boew-prettify" to an element on the page to load the component (once per page).
  2. Apply class="prettyprint" to a pre or code element to apply syntax highlighting. Alternatively use class="wet-boew-prettify all-pre" to apply syntax highlighting to all pre elements on the page.
  3. Apply class="linenums" to a pre or code element to add line numbers. Alternatively use class="wet-boew-prettify linenums" to all applicable pre elements. Specify the starting number by adding linenums:# before linenums.
  4. Add extra language support by using class="wet-boew-prettify lang-*" (e.g., class="wet-boew-prettify lang-css") and applying class="lang-*" to each applicable pre or code element.

Examples

Development

Prettify is dependent upon google-code-prettify (Apache License 2.0).

The code for Prettify is located in several places within the source folder of WET:

Known Issues

There are no known issues at this point in time.

Version History

References