Prettify
Overview
Project lead: Paul Jackson (@pjackson28)
Purpose
Provides syntax highlighting of source code snippets in an HTML page using google-code-prettify.
Implementation
- Apply
class="wet-boew-prettify"to an element on the page to load the component (once per page). - Apply
class="prettyprint"to apreorcodeelement to apply syntax highlighting. Alternatively useclass="wet-boew-prettify all-pre"to apply syntax highlighting to allpreelements on the page. - Apply
class="linenums"to apreorcodeelement to add line numbers. Alternatively useclass="wet-boew-prettify linenums"to all applicablepreelements. Specify the starting number by addinglinenums:#beforelinenums. - Add extra language support by using
class="wet-boew-prettify lang-*"(e.g.,class="wet-boew-prettify lang-css") and applyingclass="lang-*"to each applicablepreorcodeelement.
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:
- js/workers/prettify.js - contains the JavaScript code for prettify
- js/sass/includes/_prettify.scss - contains the CSS for prettify
- js/dependencies/prettify.js - main script file for google-code-prettify
Known Issues
There are no known issues at this point in time.
Version History
References
- Date modified: