| OLD | NEW |
| (Empty) |
| 1 # Google Code Prettify | |
| 2 | |
| 3 Direct port of svn into git from http://google-code-prettify.googlecode.com/svn/
trunk/ | |
| 4 | |
| 5 ## Install | |
| 6 | |
| 7 via [Bower](http://twitter.github.com/bower/) | |
| 8 | |
| 9 bower install google-code-prettify | |
| 10 | |
| 11 or [Yeoman](http://yeoman.io/) | |
| 12 | |
| 13 yeoman install google-code-prettify | |
| 14 | |
| 15 | |
| 16 ## Usage | |
| 17 | |
| 18 The prettify script is AMD compatible and can be used modularly. Here is an exam
ple of it in an AMD module: | |
| 19 | |
| 20 ```javascript | |
| 21 define(['jquery', 'prettify'], function($, prettify){ | |
| 22 var code = null; | |
| 23 $('pre').addClass('prettyprint').each(function(idx, el){ | |
| 24 code = el.firstChild; | |
| 25 code.innerHTML = prettify.prettyPrintOne(code.innerHTML)
; | |
| 26 }) | |
| 27 ); | |
| 28 }); | |
| 29 ``` | |
| 30 | |
| 31 This version of google-code-prettify defines an anonymous module, which is more
flexible. To allow your AMD loader to find google-code-prettify with a more con
venient name, map a path to it as follows: | |
| 32 | |
| 33 ```js | |
| 34 // using RequireJS | |
| 35 require.config({ | |
| 36 prettify: 'bower_components/google-code-prettify/prettify' | |
| 37 }); | |
| 38 | |
| 39 // using curl.js | |
| 40 curl.config({ | |
| 41 prettify: 'bower_components/google-code-prettify/prettify' | |
| 42 }); | |
| 43 ``` | |
| 44 | |
| 45 Or it may just be used in a global context like the following: | |
| 46 | |
| 47 ```javascript | |
| 48 (function(){ | |
| 49 $('pre').addClass('prettyprint'); | |
| 50 prettyPrint(); | |
| 51 })(); | |
| 52 ``` | |
| 53 | |
| 54 More information can be found in the original [README.html](http://google-code-p
rettify.googlecode.com/svn/trunk/README.html) | |
| OLD | NEW |