| 1 | <!DOCTYPE html> |
|---|
| 2 | <!-- |
|---|
| 3 | Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. |
|---|
| 4 | For licensing, see LICENSE.md or http://ckeditor.com/license |
|---|
| 5 | --> |
|---|
| 6 | <html> |
|---|
| 7 | <head> |
|---|
| 8 | <meta charset="utf-8"> |
|---|
| 9 | <title>Code Snippet GeSHi — CKEditor Sample</title> |
|---|
| 10 | <script src="../ckeditor/ckeditor.js"></script> |
|---|
| 11 | <link href="../ckeditor/samples/sample.css" rel="stylesheet"> |
|---|
| 12 | </head> |
|---|
| 13 | <body> |
|---|
| 14 | <h1 class="samples"> |
|---|
| 15 | <a href="../../../samples/index.html">CKEditor Samples</a> » Code Snippet GeSHi |
|---|
| 16 | </h1> |
|---|
| 17 | |
|---|
| 18 | <div class="description"> |
|---|
| 19 | <p> |
|---|
| 20 | The <strong>Code Snippet GeSHi</strong> is an extension of <code>codesnippet</code> plugin, |
|---|
| 21 | which uses <a href="http://qbnz.com/highlighter/">GeSHi</a> server-side syntax highlighting engine instead |
|---|
| 22 | of default, client-side <a href="http://highlightjs.org">highlight.js</a>. |
|---|
| 23 | </p> |
|---|
| 24 | <p> |
|---|
| 25 | With <code>codesnippetgeshi</code> loaded, <code>codeSnippet_languages</code> config variable can be used |
|---|
| 26 | to reduce list of available languages. |
|---|
| 27 | </p> |
|---|
| 28 | |
|---|
| 29 | <pre class="samples"> |
|---|
| 30 | CKEDITOR.replace( 'editor1', { |
|---|
| 31 | extraPlugins: 'codesnippet,codesnippetgeshi', |
|---|
| 32 | codeSnippet_languages: { |
|---|
| 33 | html4strict: 'HTML', |
|---|
| 34 | html5: 'HTML5', |
|---|
| 35 | javascript: 'JavaScript', |
|---|
| 36 | php: 'PHP', |
|---|
| 37 | sql: 'SQL' |
|---|
| 38 | }, |
|---|
| 39 | codeSnippetGeshi_url: 'http://example.com/geshi/colorize.php' |
|---|
| 40 | } ); |
|---|
| 41 | </pre> |
|---|
| 42 | |
|---|
| 43 | <p id="ie8-warning"> |
|---|
| 44 | Please note that this plugin is not compatible with Internet Explorer 8. |
|---|
| 45 | </p> |
|---|
| 46 | </div> |
|---|
| 47 | |
|---|
| 48 | <textarea id="editor1"> |
|---|
| 49 | <p>A bit of JS:</p> |
|---|
| 50 | <pre><code class="language-php">&lt;?php |
|---|
| 51 | isset( $foo ); |
|---|
| 52 | # Comment |
|---|
| 53 | // Comment2 |
|---|
| 54 | function foo( $bar ) { |
|---|
| 55 | if ( $bar &gt; 3 ) { |
|---|
| 56 | echo "aaa"; |
|---|
| 57 | } |
|---|
| 58 | }</code></pre> |
|---|
| 59 | |
|---|
| 60 | <p>quick sql</p> |
|---|
| 61 | <pre> |
|---|
| 62 | <code class="language-sql">SELECT cust.id, cust.name, loc.city FROM cust LEFT JOIN loc ON ( cust.loc_id = loc.id ) GROUP BY cust.type WHERE cust.type IN ( 1, 2, 3, 4, 5 );</code></pre> |
|---|
| 63 | |
|---|
| 64 | <p>A bit of uknown markup:</p> |
|---|
| 65 | <pre><code>moo(); <strong>// Why not cow?</strong> |
|---|
| 66 | </code></pre> |
|---|
| 67 | </textarea> |
|---|
| 68 | |
|---|
| 69 | <script> |
|---|
| 70 | // Default editor initialization. |
|---|
| 71 | CKEDITOR.replace( 'editor1', { |
|---|
| 72 | extraPlugins: 'codesnippet,codesnippetgeshi', |
|---|
| 73 | toolbar: [ |
|---|
| 74 | [ 'Source', 'Sourcedialog' ], [ 'Undo', 'Redo' ], [ 'Bold', 'Italic', 'Underline' ], [ 'CodeSnippet' ] |
|---|
| 75 | ], |
|---|
| 76 | codeSnippet_languages: { |
|---|
| 77 | html4strict: 'HTML', |
|---|
| 78 | html5: 'HTML5', |
|---|
| 79 | javascript: 'JavaScript', |
|---|
| 80 | php: 'PHP', |
|---|
| 81 | sql: 'SQL' |
|---|
| 82 | }, |
|---|
| 83 | codeSnippetGeshi_url: '/geshi/colorize.php' |
|---|
| 84 | } ); |
|---|
| 85 | |
|---|
| 86 | if ( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) |
|---|
| 87 | CKEDITOR.document.getById( 'ie8-warning' ).addClass( 'warning' ); |
|---|
| 88 | </script> |
|---|
| 89 | |
|---|
| 90 | <div id="footer"> |
|---|
| 91 | <hr> |
|---|
| 92 | <p> |
|---|
| 93 | CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> |
|---|
| 94 | </p> |
|---|
| 95 | <p id="copy"> |
|---|
| 96 | Copyright © 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico |
|---|
| 97 | Knabben. All rights reserved. |
|---|
| 98 | </p> |
|---|
| 99 | </div> |
|---|
| 100 | </body> |
|---|
| 101 | </html> |
|---|