Ticket #11480: codesnippetgeshi.html

File codesnippetgeshi.html, 2.9 KB (added by Olek Nowodziński, 10 years ago)

Sample to test Code Snippet Geshi

Line 
1<!DOCTYPE html>
2<!--
3Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.md or http://ckeditor.com/license
5-->
6<html>
7<head>
8        <meta charset="utf-8">
9        <title>Code Snippet GeSHi &mdash; 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> &raquo; 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">
30CKEDITOR.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&lt;p&gt;A bit of JS:&lt;/p&gt;
50&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;&amp;lt;?php
51isset( $foo );
52# Comment
53// Comment2
54function foo( $bar ) {
55  if ( $bar &amp;gt; 3 ) {
56   echo &quot;aaa&quot;;
57  }
58}&lt;/code&gt;&lt;/pre&gt;
59
60&lt;p&gt;quick sql&lt;/p&gt;
61&lt;pre&gt;
62&lt;code class=&quot;language-sql&quot;&gt;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 );&lt;/code&gt;&lt;/pre&gt;
63
64&lt;p&gt;A bit of uknown markup:&lt;/p&gt;
65&lt;pre&gt;&lt;code&gt;moo(); &lt;strong&gt;// Why not cow?&lt;/strong&gt;
66&lt;/code&gt;&lt;/pre&gt;
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 &copy; 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>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy