Browse Source

First Version ( v0.1 )

First Version of the PrismHighlight Mediawiki extension.
master
Andrew Senetar 6 years ago
commit
7e04feff9f
44 changed files with 2473 additions and 0 deletions
  1. 22
    0
      .gitattributes
  2. 36
    0
      .gitignore
  3. 65
    0
      LICENSE.md
  4. 66
    0
      PrismHighlight.base.php
  5. 39
    0
      PrismHighlight.i18n.php
  6. 158
    0
      PrismHighlight.php
  7. 100
    0
      README.md
  8. 6
    0
      init.js
  9. 4
    0
      overrides.css
  10. 24
    0
      prism/components/prism-bash.js
  11. 9
    0
      prism/components/prism-c.js
  12. 26
    0
      prism/components/prism-clike.js
  13. 16
    0
      prism/components/prism-coffeescript.js
  14. 4
    0
      prism/components/prism-cpp.js
  15. 16
    0
      prism/components/prism-css-extras.js
  16. 26
    0
      prism/components/prism-css.js
  17. 30
    0
      prism/components/prism-groovy.js
  18. 8
    0
      prism/components/prism-java.js
  19. 26
    0
      prism/components/prism-javascript.js
  20. 41
    0
      prism/components/prism-markup.js
  21. 60
    0
      prism/components/prism-php.js
  22. 14
    0
      prism/components/prism-python.js
  23. 36
    0
      prism/components/prism-scss.js
  24. 13
    0
      prism/components/prism-sql.js
  25. 3
    0
      prism/plugins/prism-autolinker.css
  26. 61
    0
      prism/plugins/prism-autolinker.js
  27. 52
    0
      prism/plugins/prism-file-highlight.js
  28. 3
    0
      prism/plugins/prism-ie8.css
  29. 42
    0
      prism/plugins/prism-ie8.js
  30. 47
    0
      prism/plugins/prism-line-highlight.css
  31. 94
    0
      prism/plugins/prism-line-highlight.js
  32. 40
    0
      prism/plugins/prism-line-numbers.css
  33. 24
    0
      prism/plugins/prism-line-numbers.js
  34. 17
    0
      prism/plugins/prism-show-invisibles.css
  35. 15
    0
      prism/plugins/prism-show-invisibles.js
  36. 11
    0
      prism/plugins/prism-wpd.css
  37. 159
    0
      prism/plugins/prism-wpd.js
  38. 356
    0
      prism/prism-core.js
  39. 106
    0
      prism/prism.css
  40. 111
    0
      prism/themes/prism-dark.css
  41. 100
    0
      prism/themes/prism-funky.css
  42. 108
    0
      prism/themes/prism-okaidia.css
  43. 107
    0
      prism/themes/prism-tomorrow.css
  44. 172
    0
      prism/themes/prism-twilight.css

+ 22
- 0
.gitattributes View File

@@ -0,0 +1,22 @@
1
+# Auto detect text files and perform LF normalization
2
+* text=auto
3
+
4
+# Custom for Visual Studio
5
+*.cs     diff=csharp
6
+*.sln    merge=union
7
+*.csproj merge=union
8
+*.vbproj merge=union
9
+*.fsproj merge=union
10
+*.dbproj merge=union
11
+
12
+# Standard to msysgit
13
+*.doc	 diff=astextplain
14
+*.DOC	 diff=astextplain
15
+*.docx diff=astextplain
16
+*.DOCX diff=astextplain
17
+*.dot  diff=astextplain
18
+*.DOT  diff=astextplain
19
+*.pdf  diff=astextplain
20
+*.PDF	 diff=astextplain
21
+*.rtf	 diff=astextplain
22
+*.RTF	 diff=astextplain

+ 36
- 0
.gitignore View File

@@ -0,0 +1,36 @@
1
+#############
2
+## Windows 
3
+#############
4
+
5
+# Windows image file caches
6
+Thumbs.db
7
+ehthumbs.db
8
+
9
+# Folder config file
10
+Desktop.ini
11
+
12
+# Recycle Bin used on file shares
13
+$RECYCLE.BIN/
14
+
15
+#############
16
+## OSX 
17
+#############
18
+.DS_Store
19
+.AppleDouble
20
+.LSOverride
21
+Icon
22
+
23
+# Thumbnails
24
+._*
25
+
26
+# Files that might appear on external disk
27
+.Spotlight-V100
28
+.Trashes
29
+
30
+#############
31
+## Linux
32
+#############
33
+.*
34
+!.gitignore
35
+!.gitattributes
36
+*~

+ 65
- 0
LICENSE.md View File

@@ -0,0 +1,65 @@
1
+Licenses
2
+=========
3
+
4
+The licenses for PrismHighlight and all components are listed below.
5
+
6
+
7
+Project License
8
+----------------
9
+
10
+~~~
11
+MIT LICENSE
12
+
13
+Copyright (c) 2013 Andrew Senetar <[email protected]>
14
+
15
+Permission is hereby granted, free of charge, to any person obtaining
16
+a copy of this software and associated documentation files (the
17
+"Software"), to deal in the Software without restriction, including
18
+without limitation the rights to use, copy, modify, merge, publish,
19
+distribute, sublicense, and/or sell copies of the Software, and to
20
+permit persons to whom the Software is furnished to do so, subject to
21
+the following conditions:
22
+
23
+The above copyright notice and this permission notice shall be
24
+included in all copies or substantial portions of the Software.
25
+
26
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33
+
34
+~~~
35
+
36
+Component Licenses 
37
+-------------------
38
+
39
+### Prism
40
+
41
+~~~
42
+MIT LICENSE
43
+
44
+Copyright (c) 2012-2013 Lea Verou
45
+
46
+Permission is hereby granted, free of charge, to any person obtaining 
47
+a copy of this software and associated documentation files (the
48
+"Software"), to deal in the Software without restriction, including 
49
+without limitation the rights to use, copy, modify, merge, publish, 
50
+distribute, sublicense, and/or sell copies of the Software, and to 
51
+permit persons to whom the Software is furnished to do so, subject to 
52
+the following conditions:
53
+
54
+The above copyright notice and this permission notice shall be 
55
+included in all copies or substantial portions of the Software.
56
+
57
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
58
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
59
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
60
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
61
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
62
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
63
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64
+~~~
65
+

+ 66
- 0
PrismHighlight.base.php View File

@@ -0,0 +1,66 @@
1
+<?php
2
+if ( ! defined( 'MEDIAWIKI' ) )
3
+    die();
4
+/**#@+
5
+ * A code highlighter using the prismjs.com code highlighter 
6
+ * (c) 2013 Andrew Senetar <[email protected]>
7
+ *
8
+ * @file 
9
+ * @link http://
10
+ * @ingroup Extensions
11
+ * @author Andrew Senetar <[email protected]>
12
+ * @copyright (c) 2013 by Andrew Senetar
13
+ * @license http://opensource.org/licenses/MIT MIT License 
14
+ */
15
+
16
+/**
17
+ * Implements the AuthPlugin for the SimpleSSO extension
18
+ * 
19
+ * @author Andrew Senetar
20
+ */
21
+
22
+ class PrismHighlight {
23
+    
24
+    public static function parserHook($text, $args = array(), $parser) {
25
+        $code_classes = '';
26
+        $pre_args ='';
27
+        if(!isset($args['lang']) || !isset($args['language']))
28
+            $args['lang'] = 'markup';
29
+        foreach( $args as $key => $value ){
30
+            switch ($key) {
31
+                case 'lang':
32
+                case 'language':
33
+                    $code_classes .= " language-$value";
34
+                    break;
35
+                case 'class':
36
+                    $code_classes .= " $value";
37
+                    break;
38
+                case 'line-numbers':
39
+                    $pre_args .= " class=$key";
40
+                    break;
41
+                case 'data-start':
42
+                    $pre_args .= " data-line-offset=$value"; //should make sure this is set
43
+                default;
44
+                    $pre_args .= " $key=$value";
45
+            }
46
+        }    
47
+
48
+        # Replace all '&', '<,' and '>' with their HTML entitites. Order is
49
+        # important. You have to do '&' first.
50
+        # not sure if this helps us
51
+        $text = str_replace('&', '&amp;', $text);
52
+        $text = str_replace('<', '&lt;', $text);
53
+        $text = str_replace('>', '&gt;', $text);
54
+        $text = trim($text); // trim any begining / end whitespace as it is ugly
55
+
56
+        return"<pre $pre_args><code class=\"$code_classes\">$text</code></pre>";
57
+    }
58
+    
59
+    // load modules
60
+    public static function beforePageDisplay(&$wgOut, &$sk) {
61
+        $wgOut->addModules('ext.PrismHighlight');
62
+        $wgOut->addModules('ext.PrismHighlight.core');
63
+        // Continue
64
+        return true;
65
+    }
66
+ }

+ 39
- 0
PrismHighlight.i18n.php View File

@@ -0,0 +1,39 @@
1
+<?php
2
+if ( ! defined( 'MEDIAWIKI' ) )
3
+    die();
4
+/**#@+
5
+ * A code highlighter using the prismjs.com code highlighter 
6
+ * (c) 2013 Andrew Senetar <[email protected]>
7
+ *
8
+ * @file 
9
+ * @link http://
10
+ * @ingroup Extensions
11
+ * @author Andrew Senetar <[email protected]>
12
+ * @copyright (c) 2013 by Andrew Senetar
13
+ * @license http://opensource.org/licenses/MIT MIT License 
14
+ */
15
+
16
+$messages = array();
17
+
18
+/**
19
+ * English
20
+ * 
21
+ * @author Andrew Senetar
22
+ */
23
+$messages[ 'en' ] = array(
24
+    'prismhighlight-desc' => 'Code highlighting using the prismjs highlighter',
25
+);
26
+
27
+/**
28
+ * Message Documentation
29
+ *
30
+ * @author Andrew Senetar
31
+ */
32
+$messages[ 'qqq' ] = array(
33
+    'prismhighlight-desc' => '{{desc|name=PrismHighlight|url=http://}}',
34
+);
35
+
36
+/**
37
+ * Add other languages below here
38
+ */
39
+

+ 158
- 0
PrismHighlight.php View File

@@ -0,0 +1,158 @@
1
+<?php
2
+if ( ! defined( 'MEDIAWIKI' ) )
3
+    die();
4
+/**#@+
5
+ * A code highlighter using the prismjs.com code highlighter 
6
+ *
7
+ * @file 
8
+ * @link http://
9
+ * @ingroup Extensions
10
+ * @author Andrew Senetar <[email protected]>
11
+ * @copyright (c) 2013 by Andrew Senetar
12
+ * @license http://opensource.org/licenses/MIT MIT License 
13
+ */
14
+
15
+$wgExtensionCredits['other'][] = array(
16
+    'path' => __FILE__,
17
+    'name' => 'PrismHighlight',
18
+    'version' => 0.1,
19
+    'author' => 'Andrew Senetar',
20
+    //'url' => 'http://',
21
+    'descriptionmsg' =>'prismhighlight-desc', 
22
+);
23
+
24
+/**
25
+ * Configuration variables for the extension
26
+ */
27
+ 
28
+ // Default languages to load
29
+if (! isset($wgPrismHighlightLanguages)) {
30
+  $wgPrismHighlightLanguages = array(
31
+    'bash',
32
+    'c',
33
+    'css',
34
+    'javascript',
35
+    'python',
36
+    'php',
37
+    'sql',
38
+    'markup',
39
+  );
40
+}
41
+
42
+// List of plugins to load (none by default)
43
+// autolinker does not appear to work nor does show-invisibles 
44
+// line-number and line-highlight should not be used together since it breaks visual
45
+if (! isset($wgPrismHighlightPlugins)) {
46
+  $wgPrismHighlightPlugins = array(
47
+  );
48
+}
49
+
50
+// Allow highlighting source tags
51
+if (! isset($wgPrismHighlightSource)) {
52
+  $wgPrismHighlightSource = true;
53
+}
54
+
55
+// The theme to use (false for default)
56
+if (! isset($wgPrismHighlightTheme)) {
57
+  $wgPrismHighlightTheme = false;
58
+}
59
+
60
+// Build the list for the js includes
61
+function efPrismHighlight_Scripts() {
62
+    global $wgPrismHighlightPlugins, $wgPrismHighlightLanguages;
63
+    
64
+    // some languages depend on others
65
+    $plugin_deps = array(
66
+        'bash' => 'clike',
67
+        'c' => 'clike',
68
+        'coffeescript' => 'javascript',
69
+        'cpp' => 'c',
70
+        'groovy' => 'clike',
71
+        'java' => 'clike',
72
+        'javascript' => 'clike',
73
+        'php' => 'clike',
74
+        'scss' => 'css',  
75
+    );
76
+    
77
+    // make sure all needed languages are loaded
78
+    $langs = $wgPrismHighlightLanguages;
79
+    foreach($langs  as $lang ){
80
+        if( array_key_exists( $lang, $plugin_deps ) )
81
+            $langs[] = $plugin_deps[$lang];
82
+    }
83
+    // remove duplicates order matters...
84
+    $langs = array_unique( array_reverse( $langs ) );
85
+    
86
+    // load plugins
87
+    foreach( $wgPrismHighlightPlugins as $plugin )
88
+        $scripts[] = "prism/plugins/prism-$plugin.js";
89
+        
90
+    // load languages
91
+    foreach( $langs as $lang )  
92
+        $scripts[] = "prism/components/prism-$lang.js";
93
+    return $scripts;    
94
+}
95
+
96
+// build list of styles to include
97
+function efPrismHighlight_Styles() {
98
+    global $wgPrismHighlightPlugins, $wgPrismHighlightTheme;
99
+    
100
+    // stop mediawiki from causing problems
101
+    $styles[] = 'overrides.css';
102
+    
103
+    // load the theme or not
104
+    if( $wgPrismHighlightTheme != false )
105
+        $styles[] = "prism/themes/prism-$wgPrismHighlightTheme.css";
106
+    else
107
+        $styles[] = "prism/prism.css";
108
+        
109
+    // load plugin styles
110
+    foreach($wgPrismHighlightPlugins as $plugin)
111
+        $styles[] = "prism/plugins/prism-$plugin.css";
112
+    return $styles;    
113
+}
114
+
115
+/**
116
+ *  Setup for the extension
117
+ */
118
+$wgAutoloadClasses['PrismHighlight'] = dirname(__FILE__) . '/PrismHighlight.base.php';
119
+$wgExtensionMessagesFiles['PrismHighlight'] = dirname(__FILE__) . '/PrismHighlight.i18n.php';
120
+
121
+/**
122
+ * Resource Modules
123
+ */
124
+ 
125
+ // styles and scripts to load after core is in place
126
+$wgResourceModules['ext.PrismHighlight'] = array(
127
+    'localBasePath' => dirname(__FILE__),
128
+    'remoteExtPath' => 'PrismHighlight',
129
+    'styles' => efPrismHighlight_Styles(),
130
+    'scripts' => efPrismHighlight_Scripts(),
131
+    'dependencies' => 'ext.PrismHighlight.core',
132
+);
133
+
134
+// the core
135
+$wgResourceModules['ext.PrismHighlight.core'] = array(
136
+    'localBasePath' => dirname(__FILE__),
137
+    'remoteExtPath' => 'PrismHighlight',
138
+    'scripts' => array( 'prism/prism-core.js', 'init.js' ),
139
+);
140
+
141
+/**
142
+ * Hooks
143
+ */
144
+// Register parser hook
145
+$wgHooks['ParserFirstCallInit'][] = 'efPrismHighlight_Setup';
146
+// Register before display hook to load css / js files
147
+$wgHooks['BeforePageDisplay'][] = 'PrismHighlight::beforePageDisplay';
148
+
149
+/**
150
+ * Register parser hook
151
+ */
152
+function efPrismHighlight_Setup( &$parser ) {
153
+    global $wgPrismHighlightSource;
154
+    if( $wgPrismHighlightSource)
155
+        $parser->setHook('source', array('PrismHighlight', 'parserHook'));
156
+    $parser->setHook('syntaxhighlight', array('PrismHighlight', 'parserHook'));
157
+    return true;
158
+}

+ 100
- 0
README.md View File

@@ -0,0 +1,100 @@
1
+PrismHighlight
2
+===============
3
+ Prism highlight is a syntax highlighting extension for [Mediawiki](http://www.mediawiki.org/ "MediaWiki") which uses the [Prism](http://prismjs.com/ "Prism") JavaScript syntax highlighter.
4
+
5
+Installation
6
+-------------
7
+To install the extension clone the source into your extensions directory:
8
+~~~
9
+cd /path/to/wiki/extensions
10
+git clone https://github.com/arsenetar/PrismHighlight.git 
11
+~~~
12
+Alternatively you may download the source via [zip](https://github.com/arsenetar/PrismHighlight/archive/master.zip).
13
+
14
+To activate the extension open your `LocalSettings.php` file and add the following:
15
+~~~
16
+require_once("$IP/extensions/PrismHighlight/PrismHighlight.php");
17
+~~~
18
+
19
+Configuration
20
+--------------
21
+The following are the configuration options for the `Localsettings.php` file ( defaults shown ):
22
+~~~
23
+/**
24
+ * Theme to use
25
+ * options: dark, funky, okaidia, tomoorrow, twilight, false ( default )
26
+ * /
27
+$wgPrismHighlightTheme = false;
28
+
29
+/**
30
+ * Allow to highlight <source> tags
31
+ * options: true / false
32
+ */
33
+$wgPrismHighlightSource = true;
34
+
35
+/**
36
+ * Plugins to use
37
+ * options: autolinker, file-highlight, ie8, line-highlight, line-numbers,
38
+ *   show-invisibles, wpd 
39
+ * note: autolinker and show-invisibles do not appear to work for some reason
40
+ */
41
+$wgPrismHighlightPlugins = array(
42
+  );
43
+
44
+/**
45
+ * Languages to load
46
+ * options: bash, c, clike, coffeescript, cpp, css, css-extras, groovy, 
47
+ *   java, javascript, markup, php, python, scss, sql
48
+ */
49
+$wgPrismHighlightLanguages = array(
50
+    'bash',
51
+    'c',
52
+    'css',
53
+    'javascript',
54
+    'python',
55
+    'php',
56
+    'sql',
57
+    'markup',
58
+  );
59
+~~~
60
+
61
+Use
62
+----
63
+To use the syntax highlighter in wiki markup create the following:
64
+~~~
65
+<source>
66
+ //[...]
67
+</source>
68
+~~~
69
+Place your code where `//[...]` is.
70
+
71
+Now the following parameters may be passed to the `<source>` tag:
72
+
73
+- `lang` or `language` - language to use (none specified uses markup)
74
+- `data-start` - the starting line number for numbering or highlight
75
+- `data-lines` - the lines to highlight
76
+- `line-numbers` - used as a flag to specify line numbers should be used
77
+
78
+### Example
79
+~~~
80
+<source lang=php data-start=29 line-numbers>
81
+    foreach( $args as $key => $value ){
82
+        switch ($key) {
83
+            case 'lang':
84
+            case 'language':
85
+                $code_classes .= " language-$value";
86
+                break;
87
+            case 'class':
88
+                $code_classes .= " $value";
89
+                break;
90
+            case 'line-numbers':
91
+                $pre_args .= " class=$key";
92
+                break;
93
+            case 'data-start':
94
+                $pre_args .= " data-line-offset=$value"; //should make sure this is set
95
+            default;
96
+                $pre_args .= " $key=$value";
97
+        }
98
+    }  
99
+</source>
100
+~~~

+ 6
- 0
init.js View File

@@ -0,0 +1,6 @@
1
+// jQuery.ready() fires when still at 'interactive' which is does not work for this script
2
+document.onreadystatechange = function () {
3
+    if (document.readyState == "complete") {
4
+        Prism.highlightAll();
5
+    }
6
+}

+ 4
- 0
overrides.css View File

@@ -0,0 +1,4 @@
1
+/* Stop Mediawiki from changing the background of code tags */
2
[email protected] screen{
3
+ code{ background: inherit !important;}
4
+} 

+ 24
- 0
prism/components/prism-bash.js View File

@@ -0,0 +1,24 @@
1
+Prism.languages.bash = Prism.languages.extend('clike', {
2
+	'comment': {
3
+		pattern: /(^|[^"{\\])(#.*?(\r?\n|$))/g,
4
+		lookbehind: true
5
+	},
6
+	'string': {
7
+		//allow multiline string
8
+		pattern: /("|')(\\?[\s\S])*?\1/g,
9
+		inside: {
10
+			//'property' class reused for bash variables
11
+			'property': /\$([a-zA-Z0-9_#\?\-\*[email protected]]+|\{[^\}]+\})/g
12
+		}
13
+	},
14
+	'keyword': /\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g
15
+});
16
+
17
+Prism.languages.insertBefore('bash', 'keyword', {
18
+	//'property' class reused for bash variables
19
+	'property': /\$([a-zA-Z0-9_#\?\-\*[email protected]]+|\{[^}]+\})/g
20
+});
21
+Prism.languages.insertBefore('bash', 'comment', {
22
+	//shebang must be before comment, 'important' class from css reused
23
+	'important': /(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g
24
+});

+ 9
- 0
prism/components/prism-c.js View File

@@ -0,0 +1,9 @@
1
+Prism.languages.c = Prism.languages.extend('clike', {
2
+	'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/g,
3
+	'operator': /[-+]{1,2}|!=?|&lt;{1,2}=?|&gt;{1,2}=?|\-&gt;|={1,2}|\^|~|%|(&amp;){1,2}|\|?\||\?|\*|\//g
4
+});
5
+
6
+Prism.languages.insertBefore('c', 'keyword', {
7
+	//property class reused for macro statements
8
+	'property': /#\s*[a-zA-Z]+/g
9
+});

+ 26
- 0
prism/components/prism-clike.js View File

@@ -0,0 +1,26 @@
1
+Prism.languages.clike = {
2
+	'comment': {
3
+		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,
4
+		lookbehind: true
5
+	},
6
+	'string': /("|')(\\?.)*?\1/g,
7
+	'class-name': {
8
+		pattern: /((?:class|interface|extends|implements|trait|instanceof|new)\s+)[a-z0-9_\.\\]+/ig,
9
+		lookbehind: true,
10
+		inside: {
11
+			punctuation: /(\.|\\)/
12
+		}
13
+	},
14
+	'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,
15
+	'boolean': /\b(true|false)\b/g,
16
+	'function': {
17
+		pattern: /[a-z0-9_]+\(/ig,
18
+		inside: {
19
+			punctuation: /\(/
20
+		}
21
+	},
22
+	'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
23
+	'operator': /[-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,
24
+	'ignore': /&(lt|gt|amp);/gi,
25
+	'punctuation': /[{}[\];(),.:]/g
26
+};

+ 16
- 0
prism/components/prism-coffeescript.js View File

@@ -0,0 +1,16 @@
1
+Prism.languages.coffeescript = Prism.languages.extend('javascript', {
2
+	'block-comment': /([#]{3}\s*\r?\n(.*\s*\r*\n*)\s*?\r?\n[#]{3})/g,
3
+	'comment': /(\s|^)([#]{1}[^#^\r^\n]{2,}?(\r?\n|$))/g,
4
+	'keyword': /\b(this|window|delete|class|extends|namespace|extend|ar|let|if|else|while|do|for|each|of|return|in|instanceof|new|with|typeof|try|catch|finally|null|undefined|break|continue)\b/g
5
+});
6
+
7
+Prism.languages.insertBefore('coffeescript', 'keyword', {
8
+	'function': {
9
+		pattern: /[a-z|A-z]+\s*[:|=]\s*(\([.|a-z\s|,|:|{|}|\"|\'|=]*\))?\s*-&gt;/gi,
10
+		inside: {
11
+			'function-name': /[_?a-z-|A-Z-]+(\s*[:|=])| @[_?$?a-z-|A-Z-]+(\s*)| /g,
12
+			'operator': /[-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\//g
13
+		}
14
+	},
15
+	'attr-name': /[_?a-z-|A-Z-]+(\s*:)| @[_?$?a-z-|A-Z-]+(\s*)| /g
16
+});

+ 4
- 0
prism/components/prism-cpp.js View File

@@ -0,0 +1,4 @@
1
+Prism.languages.cpp = Prism.languages.extend('c', {
2
+	'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|delete\[\]|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|new\[\]|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/g,
3
+	'operator': /[-+]{1,2}|!=?|&lt;{1,2}=?|&gt;{1,2}=?|\-&gt;|:{1,2}|={1,2}|\^|~|%|(&amp;){1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/g
4
+});

+ 16
- 0
prism/components/prism-css-extras.js View File

@@ -0,0 +1,16 @@
1
+Prism.languages.css.selector = {
2
+	pattern: /[^\{\}\s][^\{\}]*(?=\s*\{)/g,
3
+	inside: {
4
+		'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/g,
5
+		'pseudo-class': /:[-\w]+(?:\(.*\))?/g,
6
+		'class': /\.[-:\.\w]+/g,
7
+		'id': /#[-:\.\w]+/g
8
+	}
9
+};
10
+
11
+Prism.languages.insertBefore('css', 'ignore', {
12
+	'hexcode': /#[\da-f]{3,6}/gi,
13
+	'entity': /\\[\da-f]{1,8}/gi,
14
+	'number': /[\d%\.]+/g,
15
+	'function': /(attr|calc|cross-fade|cycle|element|hsl|hsla|image|lang|linear-gradient|matrix|matrix3d|perspective|radial-gradient|repeating-linear-gradient|repeating-radial-gradient|rgb|rgba|rotate|rotatex|rotatey|rotatez|rotate3d|scale|scalex|scaley|scalez|scale3d|skew|skewx|skewy|steps|translate|translatex|translatey|translatez|translate3d|url|var)/ig
16
+});

+ 26
- 0
prism/components/prism-css.js View File

@@ -0,0 +1,26 @@
1
+Prism.languages.css = {
2
+	'comment': /\/\*[\w\W]*?\*\//g,
3
+	'atrule': /@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,
4
+	'url': /url\((["']?).*?\1\)/gi,
5
+	'selector': /[^\{\}\s][^\{\}]*(?=\s*\{)/g,
6
+	'property': /(\b|\B)[a-z-]+(?=\s*:)/ig,
7
+	'string': /("|')(\\?.)*?\1/g,
8
+	'important': /\B!important\b/gi,
9
+	'ignore': /&(lt|gt|amp);/gi,
10
+	'punctuation': /[\{\};:]/g
11
+};
12
+
13
+if (Prism.languages.markup) {
14
+	Prism.languages.insertBefore('markup', 'tag', {
15
+		'style': {
16
+			pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,
17
+			inside: {
18
+				'tag': {
19
+					pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,
20
+					inside: Prism.languages.markup.tag.inside
21
+				},
22
+				rest: Prism.languages.css
23
+			}
24
+		}
25
+	});
26
+}

+ 30
- 0
prism/components/prism-groovy.js View File

@@ -0,0 +1,30 @@
1
+Prism.languages.groovy = Prism.languages.extend('clike', {
2
+	'keyword': /\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/g,
3
+	'string': /("""|''')[\W\w]*?\1|("|'|\/)[\W\w]*?\2/g,
4
+	'number': /\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/gi,
5
+	'operator': /={0,2}~|\?\.|\*?\[email protected]|\.&amp;|\.(?=\w)|\.{2}(&lt;)?(?=\w)|-&gt;|\?:|[-+]{1,2}|!|&lt;=&gt;|(&gt;){1,3}|(&lt;){1,2}|={1,2}|(&amp;){1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%/g,
6
+	'punctuation': /\.+|[{}[\];(),:$]/g,
7
+	'annotation': /@\w+/
8
+});
9
+
10
+Prism.languages.insertBefore('groovy', 'punctuation', {
11
+	'spock-block': /\b(setup|given|when|then|and|cleanup|expect|where):/g
12
+});
13
+
14
+Prism.hooks.add('wrap', function(env) {
15
+	if (env.language === 'groovy' && env.type === 'string') {
16
+		var delimiter = env.content[0];
17
+
18
+		if (delimiter != "'") {
19
+			env.content = Prism.highlight(env.content, {
20
+				'expression': {
21
+					pattern: /([^\\])(\$(\{.*?\}|[\w\.]*))/,
22
+					lookbehind: true,
23
+					inside: Prism.languages.groovy
24
+				}
25
+			});
26
+
27
+			env.classes.push(delimiter === '/' ? 'regex' : 'gstring');
28
+		}
29
+	}
30
+});

+ 8
- 0
prism/components/prism-java.js View File

@@ -0,0 +1,8 @@
1
+Prism.languages.java = Prism.languages.extend('clike', {
2
+	'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/g,
3
+	'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\W\d*\.?\d+\b/gi,
4
+	'operator': {
5
+		pattern: /([^\.]|^)([-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\/|%|\^|(&lt;){2}|($gt;){2,3}|:|~)/g,
6
+		lookbehind: true
7
+	}
8
+});

+ 26
- 0
prism/components/prism-javascript.js View File

@@ -0,0 +1,26 @@
1
+Prism.languages.javascript = Prism.languages.extend('clike', {
2
+	'keyword': /\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,
3
+	'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g
4
+});
5
+
6
+Prism.languages.insertBefore('javascript', 'keyword', {
7
+	'regex': {
8
+		pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,
9
+		lookbehind: true
10
+	}
11
+});
12
+
13
+if (Prism.languages.markup) {
14
+	Prism.languages.insertBefore('markup', 'tag', {
15
+		'script': {
16
+			pattern: /(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,
17
+			inside: {
18
+				'tag': {
19
+					pattern: /(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,
20
+					inside: Prism.languages.markup.tag.inside
21
+				},
22
+				rest: Prism.languages.javascript
23
+			}
24
+		}
25
+	});
26
+}

+ 41
- 0
prism/components/prism-markup.js View File

@@ -0,0 +1,41 @@
1
+Prism.languages.markup = {
2
+	'comment': /&lt;!--[\w\W]*?--(&gt;|&gt;)/g,
3
+	'prolog': /&lt;\?.+?\?&gt;/,
4
+	'doctype': /&lt;!DOCTYPE.+?&gt;/,
5
+	'cdata': /&lt;!\[CDATA\[[\w\W]*?]]&gt;/i,
6
+	'tag': {
7
+		pattern: /&lt;\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?&gt;/gi,
8
+		inside: {
9
+			'tag': {
10
+				pattern: /^&lt;\/?[\w:-]+/i,
11
+				inside: {
12
+					'punctuation': /^&lt;\/?/,
13
+					'namespace': /^[\w-]+?:/
14
+				}
15
+			},
16
+			'attr-value': {
17
+				pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,
18
+				inside: {
19
+					'punctuation': /=|&gt;|"/g
20
+				}
21
+			},
22
+			'punctuation': /\/?&gt;/g,
23
+			'attr-name': {
24
+				pattern: /[\w:-]+/g,
25
+				inside: {
26
+					'namespace': /^[\w-]+?:/
27
+				}
28
+			}
29
+			
30
+		}
31
+	},
32
+	'entity': /&amp;#?[\da-z]{1,8};/gi
33
+};
34
+
35
+// Plugin to make entity title show the real entity, idea by Roman Komarov
36
+Prism.hooks.add('wrap', function(env) {
37
+
38
+	if (env.type === 'entity') {
39
+		env.attributes['title'] = env.content.replace(/&amp;/, '&');
40
+	}
41
+});

+ 60
- 0
prism/components/prism-php.js View File

@@ -0,0 +1,60 @@
1
+/**
2
+ * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
3
+ * Modified by Miles Johnson: http://milesj.me
4
+ *
5
+ * Supports the following:
6
+ * 		- Extends clike syntax
7
+ * 		- Support for PHP 5.3 and 5.4 (namespaces, traits, etc)
8
+ * 		- Smarter constant and function matching
9
+ *
10
+ * Adds the following new token classes:
11
+ * 		constant, deliminator, variable, function, scope, package, this
12
+ */
13
+
14
+Prism.languages.php = Prism.languages.extend('clike', {
15
+	'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|extends|private|protected|parent|static|throw|null|echo|print|trait|namespace|use|final|yield|goto)\b/ig,
16
+	'constant': /[A-Z0-9_]{2,}/g
17
+});
18
+
19
+Prism.languages.insertBefore('php', 'keyword', {
20
+	'deliminator': /(\?>|\?&gt;|&lt;\?php|<\?php)/ig,
21
+	'this': /\$this/,
22
+	'variable': /(\$\w+)\b/ig,
23
+	'scope': {
24
+		pattern: /\b[a-z0-9_\\]+::/ig,
25
+		inside: {
26
+			keyword: /(static|self|parent)/,
27
+			punctuation: /(::|\\)/
28
+		}
29
+	},
30
+	'package': {
31
+		pattern: /(\\|namespace\s+|use\s+)[a-z0-9_\\]+/ig,
32
+		lookbehind: true,
33
+		inside: {
34
+			punctuation: /\\/
35
+		}
36
+	}
37
+});
38
+
39
+Prism.languages.insertBefore('php', 'operator', {
40
+	'property': {
41
+		pattern: /(-&gt;)[a-z0-9_]+/ig,
42
+		lookbehind: true
43
+	}
44
+});
45
+
46
+if (Prism.languages.markup) {
47
+	Prism.languages.insertBefore('php', 'comment', {
48
+		'markup': {
49
+			pattern: /(\?>|\?&gt;)[\w\W]*?(?=(&lt;\?php|<\?php))/ig,
50
+			lookbehind : true,
51
+			inside: {
52
+				'markup': {
53
+					pattern: /&lt;\/?[\w:-]+\s*[\w\W]*?&gt;/gi,
54
+					inside: Prism.languages.markup.tag.inside
55
+				},
56
+				rest: Prism.languages.php
57
+			}
58
+		}
59
+	});
60
+}

+ 14
- 0
prism/components/prism-python.js View File

@@ -0,0 +1,14 @@
1
+Prism.languages.python= { 
2
+	'comment': {
3
+		pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
4
+		lookbehind: true
5
+	},
6
+	'string' : /("|')(\\?.)*?\1/g,
7
+	'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,
8
+	'boolean' : /\b(True|False)\b/g,
9
+	'number' : /\b-?(0x)?\d*\.?[\da-f]+\b/g,
10
+	'operator' : /[-+]{1,2}|=?&lt;|=?&gt;|!|={1,2}|(&){1,2}|(&amp;){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,
11
+	'ignore' : /&(lt|gt|amp);/gi,
12
+	'punctuation' : /[{}[\];(),.:]/g
13
+};
14
+

+ 36
- 0
prism/components/prism-scss.js View File

@@ -0,0 +1,36 @@
1
+Prism.languages.scss = Prism.languages.extend('css', {
2
+	'comment': {
3
+		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
4
+		lookbehind: true
5
+	},
6
+	// aturle is just the @***, not the entire rule (to highlight var & stuffs)
7
+	// + add ability to highlight number & unit for media queries
8
+	'atrule': /@[\w-]+(?=\s+(\(|\{|;))/gi,
9
+	// url, compassified
10
+	'url': /([-a-z]+-)*url(?=\()/gi,
11
+	// CSS selector regex is not appropriate for Sass
12
+	// since there can be lot more things (var, @ directive, nesting..)
13
+	// a selector must start at the end of a property or after a brace (end of other rules or nesting)
14
+	// it can contain some caracters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
15
+	// the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
16
+	// can "pass" as a selector- e.g: proper#{$erty})
17
+	// this one was ard to do, so please be careful if you edit this one :)
18
+	'selector': /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&amp;|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm
19
+});
20
+
21
+Prism.languages.insertBefore('scss', 'atrule', {
22
+	'keyword': /@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return)|([email protected]\s+\$[-_\w]+\s)+from/i
23
+});
24
+
25
+Prism.languages.insertBefore('scss', 'property', {
26
+	// var and interpolated vars
27
+	'variable': /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i
28
+});
29
+
30
+Prism.languages.insertBefore('scss', 'ignore', {
31
+	'placeholder': /%[-_\w]+/i,
32
+	'statement': /\B!(default|optional)\b/gi,
33
+	'boolean': /\b(true|false)\b/g,
34
+	'null': /\b(null)\b/g,
35
+	'operator': /\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g
36
+});

+ 13
- 0
prism/components/prism-sql.js View File

@@ -0,0 +1,13 @@
1
+Prism.languages.sql= { 
2
+	'comment': {
3
+		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|((--)|(\/\/)).*?(\r?\n|$))/g,
4
+		lookbehind: true
5
+	},
6
+	'string' : /("|')(\\?.)*?\1/g,
7
+	'keyword' : /\b(ACTION|ADD|AFTER|ALGORITHM|ALTER|ANALYZE|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADE|CASCADED|CASE|CHAIN|CHAR VARYING|CHARACTER VARYING|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATA|DATABASE|DATABASES|DATETIME|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DOUBLE PRECISION|DROP|DUMMY|DUMP|DUMPFILE|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE|ESCAPED BY|EXCEPT|EXEC|EXECUTE|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR|FOR EACH ROW|FORCE|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GEOMETRY|GEOMETRYCOLLECTION|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY|IDENTITY_INSERT|IDENTITYCOL|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEY|KEYS|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONGBLOB|LONGTEXT|MATCH|MATCHED|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTILINESTRING|MULTIPOINT|MULTIPOLYGON|NATIONAL|NATIONAL CHAR VARYING|NATIONAL CHARACTER|NATIONAL CHARACTER VARYING|NATIONAL VARCHAR|NATURAL|NCHAR|NCHAR VARCHAR|NEXT|NO|NO SQL|NOCHECK|NOCYCLE|NONCLUSTERED|NULLIF|NUMERIC|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUT|OUTER|OUTFILE|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC|PROCEDURE|PUBLIC|PURGE|QUICK|RAISERROR|READ|READS SQL DATA|READTEXT|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURN|RETURNS|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROWCOUNT|ROWGUIDCOL|ROWS?|RTREE|RULE|SAVE|SAVEPOINT|SCHEMA|SELECT|SERIAL|SERIALIZABLE|SESSION|SESSION_USER|SET|SETUSER|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START|STARTING BY|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLE|TABLES|TABLESPACE|TEMPORARY|TEMPTABLE|TERMINATED BY|TEXT|TEXTSIZE|THEN|TIMESTAMP|TINYBLOB|TINYINT|TINYTEXT|TO|TOP|TRAN|TRANSACTION|TRANSACTIONS|TRIGGER|TRUNCATE|TSEQUAL|TYPE|TYPES|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNPIVOT|UPDATE|UPDATETEXT|USAGE|USE|USER|USING|VALUE|VALUES|VARBINARY|VARCHAR|VARCHARACTER|VARYING|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH|WITH ROLLUP|WITHIN|WORK|WRITE|WRITETEXT)\b/gi,
8
+	'boolean' : /\b(TRUE|FALSE|NULL)\b/gi,
9
+	'number' : /\b-?(0x)?\d*\.?[\da-f]+\b/g,
10
+	'operator' : /\b(ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|IS|UNIQUE|CHARACTER SET|COLLATE|DIV|OFFSET|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b|[-+]{1}|!|=?&lt;|=?&gt;|={1}|(&amp;){1,2}|\|?\||\?|\*|\//gi,
11
+	'ignore' : /&(lt|gt|amp);/gi,
12
+	'punctuation' : /[;[\]()`,.]/g
13
+};

+ 3
- 0
prism/plugins/prism-autolinker.css View File

@@ -0,0 +1,3 @@
1
+.token a {
2
+	color: inherit;
3
+}

+ 61
- 0
prism/plugins/prism-autolinker.js View File

@@ -0,0 +1,61 @@
1
+(function(){
2
+
3
+if (!self.Prism) {
4
+	return;
5
+}
6
+
7
+var url = /\b([a-z]{3,7}:\/\/|tel:)[\w-+%~/.]+/,
8
+    email = /\b\[email protected][\w.]+[a-z]{2}/,
9
+    linkMd = /\[([^\]]+)]\(([^)]+)\)/,
10
+    
11
+	// Tokens that may contain URLs and emails
12
+    candidates = ['comment', 'url', 'attr-value', 'string'];
13
+
14
+for (var language in Prism.languages) {
15
+	var tokens = Prism.languages[language];
16
+	
17
+	Prism.languages.DFS(tokens, function (type, def) {
18
+		if (candidates.indexOf(type) > -1) {
19
+			if (!def.pattern) {
20
+				def = this[type] = {
21
+					pattern: def
22
+				};
23
+			}
24
+			
25
+			def.inside = def.inside || {};
26
+			
27
+			if (type == 'comment') {
28
+				def.inside['md-link'] = linkMd;
29
+			}
30
+			
31
+			def.inside['url-link'] = url;
32
+			def.inside['email-link'] = email;
33
+		}
34
+	});
35
+	
36
+	tokens['url-link'] = url;
37
+	tokens['email-link'] = email;
38
+}
39
+
40
+Prism.hooks.add('wrap', function(env) {
41
+	if (/-link$/.test(env.type)) {
42
+		env.tag = 'a';
43
+		
44
+		var href = env.content;
45
+		
46
+		if (env.type == 'email-link') {
47
+			href = 'mailto:' + href;
48
+		}
49
+		else if (env.type == 'md-link') {
50
+			// Markdown
51
+			var match = env.content.match(linkMd);
52
+			
53
+			href = match[2];
54
+			env.content = match[1];
55
+		}
56
+		
57
+		env.attributes.href = href;
58
+	}
59
+});
60
+
61
+})();

+ 52
- 0
prism/plugins/prism-file-highlight.js View File

@@ -0,0 +1,52 @@
1
+(function(){
2
+
3
+if (!window.Prism || !document.querySelector) {
4
+	return;
5
+}
6
+
7
+var Extensions = {
8
+	'js': 'javascript',
9
+	'html': 'markup',
10
+	'svg': 'markup'
11
+};
12
+
13
+Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) {
14
+	var src = pre.getAttribute('data-src');
15
+	var extension = (src.match(/\.(\w+)$/) || [,''])[1];
16
+	var language = Extensions[extension] || extension;
17
+	
18
+	var code = document.createElement('code');
19
+	code.className = 'language-' + language;
20
+	
21
+	pre.textContent = '';
22
+	
23
+	code.textContent = 'Loading…';
24
+	
25
+	pre.appendChild(code);
26
+	
27
+	var xhr = new XMLHttpRequest();
28
+	
29
+	xhr.open('GET', src, true);
30
+
31
+	xhr.onreadystatechange = function() {
32
+		console.log(xhr.readyState, xhr.status, src);
33
+		if (xhr.readyState == 4) {
34
+			
35
+			if (xhr.status < 400 && xhr.responseText) {
36
+				code.textContent = xhr.responseText;
37
+			
38
+				Prism.highlightElement(code);
39
+			}
40
+			else if (xhr.status >= 400) {
41
+				code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
42
+			}
43
+			else {
44
+				code.textContent = '✖ Error: File does not exist or is empty';
45
+			}
46
+		}
47
+	};
48
+	
49
+	xhr.send(null);
50
+});
51
+
52
+})();

+ 3
- 0
prism/plugins/prism-ie8.css View File

@@ -0,0 +1,3 @@
1
+.token a {
2
+	color: inherit;
3
+}

+ 42
- 0
prism/plugins/prism-ie8.js View File

@@ -0,0 +1,42 @@
1
+(function(){
2
+
3
+if (!window.Prism) {
4
+	return;
5
+}
6
+
7
+var dummy = document.createElement('header');
8
+
9
+if (!String.prototype.trim) {
10
+	String.prototype.trim = function () {
11
+		return this.replace(/^\s+/g, '').replace(/\s+$/g, '');
12
+	};
13
+}
14
+
15
+// textContent polyfill
16
+if (!('textContent' in dummy) && ('innerText' in dummy) && Object.defineProperty) {
17
+	Object.defineProperty(Element.prototype, 'textContent', {
18
+		get: function() {
19
+			return this.innerText;
20
+		},
21
+		set: function(text) {
22
+			this.innerText = text;
23
+		}
24
+	});
25
+}
26
+
27
+// IE8 doesn't have DOMContentLoaded
28
+if (!document.addEventListener && 'textContent' in dummy) {
29
+	setTimeout(Prism.highlightAll, 10);
30
+}
31
+
32
+// Test if innerHTML line break bug is present
33
+dummy.innerHTML = '\r\n';
34
+
35
+if (dummy.textContent.indexOf('\n') === -1) {
36
+	// IE8 innerHTML bug: Discards line breaks
37
+	Prism.hooks.add('after-highlight', function(env) {
38
+		env.element.innerHTML = env.highlightedCode.replace(/\r?\n/g, '<br>');
39
+	});
40
+}
41
+
42
+})();

+ 47
- 0
prism/plugins/prism-line-highlight.css View File

@@ -0,0 +1,47 @@
1
+pre[data-line] {
2
+	position: relative;
3
+	padding: 1em 0 1em 3em;
4
+}
5
+
6
+.line-highlight {
7
+	position: absolute;
8
+	left: 0;
9
+	right: 0;
10
+	padding: inherit 0;
11
+	margin-top: 1em; /* Same as .prism’s padding-top */
12
+
13
+	background: hsla(24, 20%, 50%,.08);
14
+	background: -moz-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
15
+	background: -webkit-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
16
+	background: -o-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
17
+	background: linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
18
+	
19
+	pointer-events: none;
20
+	
21
+	line-height: inherit;
22
+	white-space: pre;
23
+}
24
+
25
+	.line-highlight:before,
26
+	.line-highlight[data-end]:after {
27
+		content: attr(data-start);
28
+		position: absolute;
29
+		top: .4em;
30
+		left: .6em;
31
+		min-width: 1em;
32
+		padding: 0 .5em;
33
+		background-color: hsla(24, 20%, 50%,.4);
34
+		color: hsl(24, 20%, 95%);
35
+		font: bold 65%/1.5 sans-serif;
36
+		text-align: center;
37
+		vertical-align: .3em;
38
+		border-radius: 999px;
39
+		text-shadow: none;
40
+		box-shadow: 0 1px white;
41
+	}
42
+	
43
+	.line-highlight[data-end]:after {
44
+		content: attr(data-end);
45
+		top: auto;
46
+		bottom: .4em;
47
+	}

+ 94
- 0
prism/plugins/prism-line-highlight.js View File

@@ -0,0 +1,94 @@
1
+(function(){
2
+
3
+if(!window.Prism) {
4
+	return;
5
+}
6
+
7
+function $$(expr, con) {
8
+	return Array.prototype.slice.call((con || document).querySelectorAll(expr));
9
+}
10
+
11
+var CRLF = crlf = /\r?\n|\r/g;
12
+    
13
+function highlightLines(pre, lines, classes) {
14
+	var ranges = lines.replace(/\s+/g, '').split(','),
15
+	    offset = +pre.getAttribute('data-line-offset') || 0;
16
+	
17
+	var lineHeight = parseFloat(getComputedStyle(pre).lineHeight);
18
+
19
+	for (var i=0, range; range = ranges[i++];) {
20
+		range = range.split('-');
21
+					
22
+		var start = +range[0],
23
+		    end = +range[1] || start;
24
+		
25
+		var line = document.createElement('div');
26
+		
27
+		line.textContent = Array(end - start + 2).join(' \r\n');
28
+		line.className = (classes || '') + ' line-highlight';
29
+		line.setAttribute('data-start', start);
30
+		
31
+		if(end > start) {
32
+			line.setAttribute('data-end', end);
33
+		}
34
+	
35
+		line.style.top = (start - offset - 1) * lineHeight + 'px';
36
+		
37
+		(pre.querySelector('code') || pre).appendChild(line);
38
+	}
39
+}
40
+
41
+function applyHash() {
42
+	var hash = location.hash.slice(1);
43
+	
44
+	// Remove pre-existing temporary lines
45
+	$$('.temporary.line-highlight').forEach(function (line) {
46
+		line.parentNode.removeChild(line);
47
+	});
48
+	
49
+	var range = (hash.match(/\.([\d,-]+)$/) || [,''])[1];
50
+	
51
+	if (!range || document.getElementById(hash)) {
52
+		return;
53
+	}
54
+	
55
+	var id = hash.slice(0, hash.lastIndexOf('.')),
56
+	    pre = document.getElementById(id);
57
+	    
58
+	if (!pre) {
59
+		return;
60
+	}
61
+	
62
+	if (!pre.hasAttribute('data-line')) {
63
+		pre.setAttribute('data-line', '');
64
+	}
65
+
66
+	highlightLines(pre, range, 'temporary ');
67
+
68
+	document.querySelector('.temporary.line-highlight').scrollIntoView();
69
+}
70
+
71
+var fakeTimer = 0; // Hack to limit the number of times applyHash() runs
72
+
73
+Prism.hooks.add('after-highlight', function(env) {
74
+	var pre = env.element.parentNode;
75
+	var lines = pre && pre.getAttribute('data-line');
76
+	
77
+	if (!pre || !lines || !/pre/i.test(pre.nodeName)) {
78
+		return;
79
+	}
80
+	
81
+	clearTimeout(fakeTimer);
82
+	
83
+	$$('.line-highlight', pre).forEach(function (line) {
84
+		line.parentNode.removeChild(line);
85
+	});
86
+	
87
+	highlightLines(pre, lines);
88
+	
89
+	fakeTimer = setTimeout(applyHash, 1);
90
+});
91
+
92
+addEventListener('hashchange', applyHash);
93
+
94
+})();

+ 40
- 0
prism/plugins/prism-line-numbers.css View File

@@ -0,0 +1,40 @@
1
+pre.line-numbers {
2
+	position: relative;
3
+	padding-left: 3.8em;
4
+	counter-reset: linenumber;
5
+}
6
+
7
+pre.line-numbers > code {
8
+	position: relative;
9
+}
10
+
11
+.line-numbers .line-numbers-rows {
12
+	position: absolute;
13
+	pointer-events: none;
14
+	top: 0;
15
+	font-size: 100%;
16
+	left: -3.8em;
17
+	width: 3em; /* works for line-numbers below 1000 lines */
18
+	letter-spacing: -1px;
19
+	border-right: 1px solid #999;
20
+
21
+	-webkit-user-select: none;
22
+	-moz-user-select: none;
23
+	-ms-user-select: none;
24
+	user-select: none;
25
+
26
+}
27
+
28
+	.line-numbers-rows > span {
29
+		pointer-events: none;
30
+		display: block;
31
+		counter-increment: linenumber;
32
+	}
33
+
34
+		.line-numbers-rows > span:before {
35
+			content: counter(linenumber);
36
+			color: #999;
37
+			display: block;
38
+			padding-right: 0.8em;
39
+			text-align: right;
40
+		}

+ 24
- 0
prism/plugins/prism-line-numbers.js View File

@@ -0,0 +1,24 @@
1
+Prism.hooks.add('after-highlight', function (env) {
2
+	// works only for <code> wrapped inside <pre data-line-numbers> (not inline)
3
+	var pre = env.element.parentNode;
4
+	if (!pre || !/pre/i.test(pre.nodeName) || pre.className.indexOf('line-numbers') === -1) {
5
+		return;
6
+	}
7
+
8
+	var linesNum = (1 + env.code.split('\n').length);
9
+	var lineNumbersWrapper;
10
+
11
+	lines = new Array(linesNum);
12
+	lines = lines.join('<span></span>');
13
+
14
+	lineNumbersWrapper = document.createElement('span');
15
+	lineNumbersWrapper.className = 'line-numbers-rows';
16
+	lineNumbersWrapper.innerHTML = lines;
17
+
18
+	if (pre.hasAttribute('data-start')) {
19
+		pre.style.counterReset = 'linenumber ' + (parseInt(pre.getAttribute('data-start'), 10) - 1);
20
+	}
21
+
22
+	env.element.appendChild(lineNumbersWrapper);
23
+
24
+});

+ 17
- 0
prism/plugins/prism-show-invisibles.css View File

@@ -0,0 +1,17 @@
1
+.token.tab:not(:empty):before,
2
+.token.cr:before,
3
+.token.lf:before {
4
+	color: hsl(24, 20%, 85%);
5
+}
6
+
7
+.token.tab:not(:empty):before {
8
+	content: '▸';
9
+}
10
+
11
+.token.cr:before {
12
+	content: '␍';
13
+}
14
+
15
+.token.lf:before {
16
+	content: '␊';
17
+}

+ 15
- 0
prism/plugins/prism-show-invisibles.js View File

@@ -0,0 +1,15 @@
1
+(function(){
2
+
3
+if(!window.Prism) {
4
+	return;
5
+}
6
+
7
+for (var language in Prism.languages) {
8
+	var tokens = Prism.languages[language];
9
+	
10
+	tokens.tab = /\t/g;
11
+	tokens.lf = /\n/g;
12
+	tokens.cr = /\r/g;
13
+}
14
+
15
+})();

+ 11
- 0
prism/plugins/prism-wpd.css View File

@@ -0,0 +1,11 @@
1
+code[class*="language-"] a[href],
2
+pre[class*="language-"] a[href] {
3
+	cursor: help;
4
+	text-decoration: none;
5
+}
6
+
7
+code[class*="language-"] a[href]:hover,
8
+pre[class*="language-"] a[href]:hover {
9
+	cursor: help;
10
+	text-decoration: underline;
11
+}

+ 159
- 0
prism/plugins/prism-wpd.js View File

@@ -0,0 +1,159 @@
1
+(function(){
2
+
3
+if (!self.Prism) {
4
+	return;
5
+}
6
+
7
+if (Prism.languages.css) {
8
+	Prism.languages.css.atrule = {
9
+		pattern: Prism.languages.css.atrule,
10
+		inside: {
11
+			'atrule-id': /^@[\w-]+/
12
+		}
13
+	};
14
+	
15
+	Prism.languages.css.selector = {
16
+		pattern: Prism.languages.css.selector,
17
+		inside: {
18
+			'pseudo-class': /:[\w-]+/,
19
+			'pseudo-element': /::[\w-]+/
20
+		}
21
+	};
22
+}
23
+
24
+if (Prism.languages.markup) {
25
+	Prism.languages.markup.tag.inside.tag.inside['tag-id'] = /[\w-]+/;
26
+	
27
+	var Tags = {
28
+		HTML: {
29
+			'a': 1, 'abbr': 1, 'acronym': 1, 'b': 1, 'basefont': 1, 'bdo': 1, 'big': 1, 'blink': 1, 'cite': 1, 'code': 1, 'dfn': 1, 'em': 1, 'kbd': 1,  'i': 1, 
30
+			'rp': 1, 'rt': 1, 'ruby': 1, 's': 1, 'samp': 1, 'small': 1, 'spacer': 1, 'strike': 1, 'strong': 1, 'sub': 1, 'sup': 1, 'time': 1, 'tt': 1,  'u': 1, 
31
+			'var': 1, 'wbr': 1, 'noframes': 1, 'summary': 1, 'command': 1, 'dt': 1, 'dd': 1, 'figure': 1, 'figcaption': 1, 'center': 1, 'section': 1, 'nav': 1,
32
+			'article': 1, 'aside': 1, 'hgroup': 1, 'header': 1, 'footer': 1, 'address': 1, 'noscript': 1, 'isIndex': 1, 'main': 1, 'mark': 1, 'marquee': 1,
33
+			'meter': 1, 'menu': 1
34
+		},
35
+		SVG: {
36
+			'animateColor': 1, 'animateMotion': 1, 'animateTransform': 1, 'glyph': 1, 'feBlend': 1, 'feColorMatrix': 1, 'feComponentTransfer': 1, 
37
+			'feFuncR': 1, 'feFuncG': 1, 'feFuncB': 1, 'feFuncA': 1, 'feComposite': 1, 'feConvolveMatrix': 1, 'feDiffuseLighting': 1, 'feDisplacementMap': 1, 
38
+			'feFlood': 1, 'feGaussianBlur': 1, 'feImage': 1, 'feMerge': 1, 'feMergeNode': 1, 'feMorphology': 1, 'feOffset': 1, 'feSpecularLighting': 1, 
39
+			'feTile': 1, 'feTurbulence': 1, 'feDistantLight': 1, 'fePointLight': 1, 'feSpotLight': 1, 'linearGradient': 1, 'radialGradient': 1, 'altGlyph': 1, 
40
+			'textPath': 1, 'tref': 1, 'altglyph': 1, 'textpath': 1, 'tref': 1, 'altglyphdef': 1, 'altglyphitem': 1, 'clipPath': 1, 'color-profile': 1, 'cursor': 1, 
41
+			'font-face': 1, 'font-face-format': 1, 'font-face-name': 1, 'font-face-src': 1, 'font-face-uri': 1, 'foreignObject': 1, 'glyph': 1, 'glyphRef': 1, 
42
+			'hkern': 1, 'vkern': 1, 
43
+		},
44
+		MathML: {}
45
+	}
46
+}
47
+
48
+var language;
49
+
50
+Prism.hooks.add('wrap', function(env) {
51
+	if ((['tag-id'].indexOf(env.type) > -1
52
+		|| (env.type == 'property' && env.content.indexOf('-') != 0)
53
+		|| (env.type == 'atrule-id'&& env.content.indexOf('@-') != 0)
54
+		|| (env.type == 'pseudo-class'&& env.content.indexOf(':-') != 0) 
55
+		|| (env.type == 'pseudo-element'&& env.content.indexOf('::-') != 0) 
56
+	    || (env.type == 'attr-name' && env.content.indexOf('data-') != 0)
57
+	    ) && env.content.indexOf('<') === -1
58
+	) {
59
+		var searchURL = 'w/index.php?fulltext&search=';
60
+		
61
+		env.tag = 'a';
62
+		
63
+		var href = 'http://docs.webplatform.org/';
64
+		
65
+		if (env.language == 'css') {
66
+			href += 'wiki/css/'
67
+			
68
+			if (env.type == 'property') {
69
+				href += 'properties/';
70
+			}
71
+			else if (env.type == 'atrule-id') {
72
+				href += 'atrules/';
73
+			}
74
+			else if (env.type == 'pseudo-class') {
75
+				href += 'selectors/pseudo-classes/';
76
+			}
77
+			else if (env.type == 'pseudo-element') {
78
+				href += 'selectors/pseudo-elements/';
79
+			}
80
+		}
81
+		else if (env.language == 'markup') {
82
+			if (env.type == 'tag-id') {
83
+				// Check language
84
+				language = getLanguage(env.content) || language;
85
+				
86
+				if (language) {
87
+					href += 'wiki/' + language + '/elements/';
88
+				}
89
+				else {
90
+					href += searchURL;
91
+				}
92
+			}
93
+			else if (env.type == 'attr-name') {
94
+				if (language) {
95
+					href += 'wiki/' + language + '/attributes/';
96
+				}
97
+				else {
98
+					href += searchURL;
99
+				}
100
+			}
101
+		}
102
+		
103
+		href += env.content;
104
+		
105
+		env.attributes.href = href;
106
+		env.attributes.target = '_blank';
107
+	}
108
+});
109
+
110
+function getLanguage(tag) {
111
+	var tagL = tag.toLowerCase();
112
+	
113
+	if (Tags.HTML[tagL]) {
114
+		return 'html';
115
+	}
116
+	else if (Tags.SVG[tag]) {
117
+		return 'svg';
118
+	}
119
+	else if (Tags.MathML[tag]) {
120
+		return 'mathml';
121
+	}
122
+	
123
+	// Not in dictionary, perform check
124
+	if (Tags.HTML[tagL] !== 0) {
125
+		var htmlInterface = (document.createElement(tag).toString().match(/\[object HTML(.+)Element\]/) || [])[1];
126
+		
127
+		if (htmlInterface && htmlInterface != 'Unknown') {
128
+			Tags.HTML[tagL] = 1;
129
+			return 'html';
130
+		}
131
+	}
132
+	
133
+	Tags.HTML[tagL] = 0;
134
+	
135
+	if (Tags.SVG[tag] !== 0) {
136
+		var svgInterface = (document.createElementNS('http://www.w3.org/2000/svg', tag).toString().match(/\[object SVG(.+)Element\]/) || [])[1];
137
+		
138
+		if (svgInterface && svgInterface != 'Unknown') {
139
+			Tags.SVG[tag] = 1;
140
+			return 'svg';
141
+		}
142
+	}
143
+	
144
+	Tags.SVG[tag] = 0;
145
+	
146
+	// Lame way to detect MathML, but browsers don’t expose interface names there :(
147
+	if (Tags.MathML[tag] !== 0) {
148
+		if (tag.indexOf('m') === 0) {
149
+			Tags.MathML[tag] = 1;
150
+			return 'mathml';
151
+		}
152
+	}
153
+	
154
+	Tags.MathML[tag] = 0;
155
+	
156
+	return null;
157
+}
158
+
159
+})();

+ 356
- 0
prism/prism-core.js View File

@@ -0,0 +1,356 @@
1
+/**
2
+ * Prism: Lightweight, robust, elegant syntax highlighting
3
+ * MIT license http://www.opensource.org/licenses/mit-license.php/
4
+ * @author Lea Verou http://lea.verou.me
5
+ */
6
+
7
+(function(){
8
+
9
+// Private helper vars
10
+var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
11
+
12
+var _ = self.Prism = {
13
+	util: {
14
+		type: function (o) { 
15
+			return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
16
+		},
17
+		
18
+		// Deep clone a language definition (e.g. to extend it)
19
+		clone: function (o) {
20
+			var type = _.util.type(o);
21
+
22
+			switch (type) {
23
+				case 'Object':
24
+					var clone = {};
25
+					
26
+					for (var key in o) {
27
+						if (o.hasOwnProperty(key)) {
28
+							clone[key] = _.util.clone(o[key]);
29
+						}
30
+					}
31
+					
32
+					return clone;
33
+					
34
+				case 'Array':
35
+					return o.slice();
36
+			}
37
+			
38
+			return o;
39
+		}
40
+	},
41
+	
42
+	languages: {
43
+		extend: function (id, redef) {
44
+			var lang = _.util.clone(_.languages[id]);
45
+			
46
+			for (var key in redef) {
47
+				lang[key] = redef[key];
48
+			}
49
+			
50
+			return lang;
51
+		},
52
+		
53
+		// Insert a token before another token in a language literal
54
+		insertBefore: function (inside, before, insert, root) {
55
+			root = root || _.languages;
56
+			var grammar = root[inside];
57
+			var ret = {};
58
+				
59
+			for (var token in grammar) {
60
+			
61
+				if (grammar.hasOwnProperty(token)) {
62
+					
63
+					if (token == before) {
64
+					
65
+						for (var newToken in insert) {
66
+						
67
+							if (insert.hasOwnProperty(newToken)) {
68
+								ret[newToken] = insert[newToken];
69
+							}
70
+						}
71
+					}
72
+					
73
+					ret[token] = grammar[token];
74
+				}
75
+			}
76
+			
77
+			return root[inside] = ret;
78
+		},
79
+		
80
+		// Traverse a language definition with Depth First Search
81
+		DFS: function(o, callback) {
82
+			for (var i in o) {
83
+				callback.call(o, i, o[i]);
84
+				
85
+				if (_.util.type(o) === 'Object') {
86
+					_.languages.DFS(o[i], callback);
87
+				}
88
+			}
89
+		}
90
+	},
91
+
92
+	highlightAll: function(async, callback) {
93
+		var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');
94
+
95
+		for (var i=0, element; element = elements[i++];) {
96
+			_.highlightElement(element, async === true, callback);
97
+		}
98
+	},
99
+		
100
+	highlightElement: function(element, async, callback) {
101
+		// Find language
102
+		var language, grammar, parent = element;
103
+		
104
+		while (parent && !lang.test(parent.className)) {
105
+			parent = parent.parentNode;
106
+		}
107
+		
108
+		if (parent) {
109
+			language = (parent.className.match(lang) || [,''])[1];
110
+			grammar = _.languages[language];
111
+		}
112
+
113
+		if (!grammar) {
114
+			return;
115
+		}
116
+		
117
+		// Set language on the element, if not present
118
+		element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
119
+		
120
+		// Set language on the parent, for styling
121
+		parent = element.parentNode;
122
+		
123
+		if (/pre/i.test(parent.nodeName)) {
124
+			parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language; 
125
+		}
126
+
127
+		var code = element.textContent;
128
+		
129
+		if(!code) {
130
+			return;
131
+		}
132
+		
133
+		code = code.replace(/&/g, '&amp;').replace(/</g, '&lt;')
134
+		           .replace(/>/g, '&gt;').replace(/\u00a0/g, ' ');
135
+		//console.time(code.slice(0,50));
136
+		
137
+		var env = {
138
+			element: element,
139
+			language: language,
140
+			grammar: grammar,
141
+			code: code
142
+		};
143
+		
144
+		_.hooks.run('before-highlight', env);
145
+		
146
+		if (async && self.Worker) {
147
+			var worker = new Worker(_.filename);	
148
+			
149
+			worker.onmessage = function(evt) {
150
+				env.highlightedCode = Token.stringify(JSON.parse(evt.data), language);
151
+
152
+				_.hooks.run('before-insert', env);
153
+
154
+				env.element.innerHTML = env.highlightedCode;
155
+				
156
+				callback && callback.call(env.element);
157
+				//console.timeEnd(code.slice(0,50));
158
+				_.hooks.run('after-highlight', env);
159
+			};
160
+			
161
+			worker.postMessage(JSON.stringify({
162
+				language: env.language,
163
+				code: env.code
164
+			}));
165
+		}
166
+		else {
167
+			env.highlightedCode = _.highlight(env.code, env.grammar, env.language)
168
+
169
+			_.hooks.run('before-insert', env);
170
+
171
+			env.element.innerHTML = env.highlightedCode;
172
+			
173
+			callback && callback.call(element);
174
+			
175
+			_.hooks.run('after-highlight', env);
176
+			//console.timeEnd(code.slice(0,50));
177
+		}
178
+	},
179
+	
180
+	highlight: function (text, grammar, language) {
181
+		return Token.stringify(_.tokenize(text, grammar), language);
182
+	},
183
+	
184
+	tokenize: function(text, grammar, language) {
185
+		var Token = _.Token;
186
+		
187
+		var strarr = [text];
188
+		
189
+		var rest = grammar.rest;
190
+		
191
+		if (rest) {
192
+			for (var token in rest) {
193
+				grammar[token] = rest[token];
194
+			}
195
+			
196
+			delete grammar.rest;
197
+		}
198
+								
199
+		tokenloop: for (var token in grammar) {
200
+			if(!grammar.hasOwnProperty(token) || !grammar[token]) {
201
+				continue;
202
+			}
203
+			
204
+			var pattern = grammar[token], 
205
+				inside = pattern.inside,
206
+				lookbehind = !!pattern.lookbehind,
207
+				lookbehindLength = 0;
208
+			
209
+			pattern = pattern.pattern || pattern;
210
+			
211
+			for (var i=0; i<strarr.length; i++) { // Don’t cache length as it changes during the loop
212
+				
213
+				var str = strarr[i];
214
+				
215
+				if (strarr.length > text.length) {
216
+					// Something went terribly wrong, ABORT, ABORT!
217
+					break tokenloop;
218
+				}
219
+				
220
+				if (str instanceof Token) {
221
+					continue;
222
+				}
223
+				
224
+				pattern.lastIndex = 0;
225
+				
226
+				var match = pattern.exec(str);
227
+				
228
+				if (match) {
229
+					if(lookbehind) {
230
+						lookbehindLength = match[1].length;
231
+					}
232
+
233
+					var from = match.index - 1 + lookbehindLength,
234
+					    match = match[0].slice(lookbehindLength),
235
+					    len = match.length,
236
+					    to = from + len,
237
+						before = str.slice(0, from + 1),
238
+						after = str.slice(to + 1); 
239
+
240
+					var args = [i, 1];
241
+					
242
+					if (before) {
243
+						args.push(before);
244
+					}
245
+					
246
+					var wrapped = new Token(token, inside? _.tokenize(match, inside) : match);
247
+					
248
+					args.push(wrapped);
249
+					
250
+					if (after) {
251
+						args.push(after);
252
+					}
253
+					
254
+					Array.prototype.splice.apply(strarr, args);
255
+				}
256
+			}
257
+		}
258
+
259
+		return strarr;
260
+	},
261
+	
262
+	hooks: {
263
+		all: {},
264
+		
265
+		add: function (name, callback) {
266
+			var hooks = _.hooks.all;
267
+			
268
+			hooks[name] = hooks[name] || [];
269
+			
270
+			hooks[name].push(callback);
271
+		},
272
+		
273
+		run: function (name, env) {
274
+			var callbacks = _.hooks.all[name];
275
+			
276
+			if (!callbacks || !callbacks.length) {
277
+				return;
278
+			}
279
+			
280
+			for (var i=0, callback; callback = callbacks[i++];) {
281
+				callback(env);
282
+			}
283
+		}
284
+	}
285
+};
286
+
287
+var Token = _.Token = function(type, content) {
288
+	this.type = type;
289
+	this.content = content;
290
+};
291
+
292
+Token.stringify = function(o, language, parent) {
293
+	if (typeof o == 'string') {
294
+		return o;
295
+	}
296
+
297
+	if (Object.prototype.toString.call(o) == '[object Array]') {
298
+		return o.map(function(element) {
299
+			return Token.stringify(element, language, o);
300
+		}).join('');
301
+	}
302
+	
303
+	var env = {
304
+		type: o.type,
305
+		content: Token.stringify(o.content, language, parent),
306
+		tag: 'span',
307
+		classes: ['token', o.type],
308
+		attributes: {},
309
+		language: language,
310
+		parent: parent
311
+	};
312
+	
313
+	if (env.type == 'comment') {
314
+		env.attributes['spellcheck'] = 'true';
315
+	}
316
+	
317
+	_.hooks.run('wrap', env);
318
+	
319
+	var attributes = '';
320
+	
321
+	for (var name in env.attributes) {
322
+		attributes += name + '="' + (env.attributes[name] || '') + '"';
323
+	}
324
+	
325
+	return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>';
326
+	
327
+};
328
+
329
+if (!self.document) {
330
+	// In worker
331
+	self.addEventListener('message', function(evt) {
332
+		var message = JSON.parse(evt.data),
333
+		    lang = message.language,
334
+		    code = message.code;
335
+		
336
+		self.postMessage(JSON.stringify(_.tokenize(code, _.languages[lang])));
337
+		self.close();
338
+	}, false);
339
+	
340
+	return;
341
+}
342
+
343
+// Get current script and highlight
344
+var script = document.getElementsByTagName('script');
345
+
346
+script = script[script.length - 1];
347
+
348
+if (script) {
349
+	_.filename = script.src;
350
+	
351
+	if (document.addEventListener && !script.hasAttribute('data-manual')) {
352
+		document.addEventListener('DOMContentLoaded', _.highlightAll);
353
+	}
354
+}
355
+
356
+})();

+ 106
- 0
prism/prism.css View File

@@ -0,0 +1,106 @@
1
+/**
2
+ * prism.js default theme for JavaScript, CSS and HTML
3
+ * Based on dabblet (http://dabblet.com)
4
+ * @author Lea Verou
5
+ */
6
+code[class*="language-"],
7
+pre[class*="language-"] {
8
+	color: black;
9
+	text-shadow: 0 1px white;
10
+	font-family: Consolas, Monaco, 'Andale Mono', monospace;
11
+	direction: ltr;
12
+	text-align: left;
13
+	white-space: pre;
14
+	word-spacing: normal;
15
+	
16
+	-moz-tab-size: 4;
17
+	-o-tab-size: 4;
18
+	tab-size: 4;
19
+	
20
+	-webkit-hyphens: none;
21
+	-moz-hyphens: none;
22
+	-ms-hyphens: none;
23
+	hyphens: none;
24
+}
25
+
26
[email protected] print {
27
+	code[class*="language-"],
28
+	pre[class*="language-"] {
29
+		text-shadow: none;
30
+	}
31
+}
32
+
33
+/* Code blocks */
34
+pre[class*="language-"] {
35
+	padding: 1em;
36
+	margin: .5em 0;
37
+	overflow: auto;	
38
+}
39
+
40
+:not(pre) > code[class*="language-"],
41
+pre[class*="language-"] {
42
+	background: #f5f2f0;
43
+}
44
+
45
+/* Inline code */
46
+:not(pre) > code[class*="language-"] {
47
+	padding: .1em;
48
+	border-radius: .3em;
49
+}
50
+
51
+.token.comment,
52
+.token.prolog,
53
+.token.doctype,
54
+.token.cdata {
55
+	color: slategray;
56
+}
57
+
58
+.token.punctuation {
59
+	color: #999;
60
+}
61
+
62
+.namespace {
63
+	opacity: .7;
64
+}
65
+
66
+.token.property,
67
+.token.tag,
68
+.token.boolean,
69
+.token.number {
70
+	color: #905;
71
+}
72
+
73
+.token.selector,
74
+.token.attr-name,
75
+.token.string {
76
+	color: #690;
77
+}
78
+
79
+.token.operator,
80
+.token.entity,
81
+.token.url,
82
+.language-css .token.string,
83
+.style .token.string {
84
+	color: #a67f59;
85
+	background: hsla(0,0%,100%,.5);
86
+}
87
+
88
+.token.atrule,
89
+.token.attr-value,
90
+.token.keyword {
91
+	color: #07a;
92
+}
93
+
94
+
95
+.token.regex,
96
+.token.important {
97
+	color: #e90;
98
+}
99
+
100
+.token.important {
101
+	font-weight: bold;
102
+}
103
+
104
+.token.entity {
105
+	cursor: help;
106
+}

+ 111
- 0
prism/themes/prism-dark.css View File

@@ -0,0 +1,111 @@
1
+/**
2
+ * prism.js Dark theme for JavaScript, CSS and HTML
3
+ * Based on the slides of the talk “/Reg(exp){2}lained/”
4
+ * @author Lea Verou
5
+ */
6
+
7
+code[class*="language-"],
8
+pre[class*="language-"] {
9
+	color: white;
10
+	text-shadow: 0 -.1em .2em black;
11
+	font-family: Consolas, Monaco, 'Andale Mono', monospace;
12
+	direction: ltr;
13
+	text-align: left;
14
+	white-space: pre;
15
+	word-spacing: normal;
16
+	
17
+	-moz-tab-size: 4;
18
+	-o-tab-size: 4;
19
+	tab-size: 4;
20
+	
21
+	-webkit-hyphens: none;
22
+	-moz-hyphens: none;
23
+	-ms-hyphens: none;
24
+	hyphens: none;
25
+}
26
+
27
[email protected] print {
28
+	code[class*="language-"],
29
+	pre[class*="language-"] {
30
+		text-shadow: none;
31
+	}
32
+}
33
+
34
+pre[class*="language-"],
35
+:not(pre) > code[class*="language-"] {
36
+	background: hsl(30,20%,25%);
37
+}
38
+
39
+/* Code blocks */
40
+pre[class*="language-"] {
41
+	padding: 1em;
42
+	margin: .5em 0;
43
+	overflow: auto;	
44
+	border: .3em solid hsl(30,20%,40%);
45
+	border-radius: .5em;
46
+	box-shadow: 1px 1px .5em black inset;
47
+}
48
+
49
+/* Inline code */
50
+:not(pre) > code[class*="language-"] {
51
+	padding: .15em .2em .05em;
52
+	border-radius: .3em;
53
+	border: .13em solid hsl(30,20%,40%);
54
+	box-shadow: 1px 1px .3em -.1em black inset;
55
+}
56
+
57
+.token.comment,
58
+.token.prolog,
59
+.token.doctype,
60
+.token.cdata {
61
+	color: hsl(30,20%,50%);
62
+}
63
+
64
+.token.punctuation {
65
+	opacity: .7;
66
+}
67
+
68
+.namespace {
69
+	opacity: .7;
70
+}
71
+
72
+.token.property,
73
+.token.tag,
74
+.token.boolean,
75
+.token.number {
76
+	color: hsl(350, 40%, 70%);
77
+}
78
+
79
+.token.selector,
80
+.token.attr-name,
81
+.token.string {
82
+	color: hsl(75, 70%, 60%);
83
+}
84
+
85
+.token.operator,
86
+.token.entity,
87
+.token.url,
88
+.language-css .token.string,
89
+.style .token.string {
90
+	color: hsl(40, 90%, 60%);
91
+}
92
+
93
+.token.atrule,
94
+.token.attr-value,
95
+.token.keyword {
96
+	color: hsl(350, 40%, 70%);
97
+}
98
+
99
+
100
+.token.regex,
101
+.token.important {
102
+	color: #e90;
103
+}
104
+
105
+.token.important {
106
+	font-weight: bold;
107
+}
108
+
109
+.token.entity {
110
+	cursor: help;
111
+}

+ 100
- 0
prism/themes/prism-funky.css View File

@@ -0,0 +1,100 @@
1
+/**
2
+ * prism.js Funky theme
3
+ * Based on “Polyfilling the gaps” talk slides http://lea.verou.me/polyfilling-the-gaps/
4
+ * @author Lea Verou
5
+ */
6
+
7
+code[class*="language-"],
8
+pre[class*="language-"] {
9
+	font-family: Consolas, Monaco, 'Andale Mono', monospace;
10
+	direction: ltr;
11
+	text-align: left;
12
+	white-space: pre;
13
+	word-spacing: normal;
14
+	
15
+	-moz-tab-size: 4;
16
+	-o-tab-size: 4;
17
+	tab-size: 4;
18
+	
19
+	-webkit-hyphens: none;
20
+	-moz-hyphens: none;
21
+	-ms-hyphens: none;
22
+	hyphens: none;
23
+}
24
+
25
+/* Code blocks */
26
+pre[class*="language-"] {
27
+	padding: .4em .8em;
28
+	margin: .5em 0;
29
+	overflow: auto;
30
+	background: url('data:image/svg+xml;charset=utf-8,<svg%20version%3D"1.1"%20xmlns%3D"http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg"%20width%3D"100"%20height%3D"100"%20fill%3D"rgba(0%2C0%2C0%2C.2)">%0D%0A<polygon%20points%3D"0%2C50%2050%2C0%200%2C0"%20%2F>%0D%0A<polygon%20points%3D"0%2C100%2050%2C100%20100%2C50%20100%2C0"%20%2F>%0D%0A<%2Fsvg>');
31
+	background-size: 1em 1em;
32
+}
33
+
34
+code[class*="language-"] {
35
+	background: black;
36
+	color: white;
37
+	box-shadow: -.3em 0 0 .3em black, .3em 0 0 .3em black;
38
+}
39
+
40
+/* Inline code */
41
+:not(pre) > code[class*="language-"] {
42
+	padding: .2em;
43
+	border-radius: .3em;
44
+	box-shadow: none;
45
+}
46
+
47
+.token.comment,
48
+.token.prolog,
49
+.token.doctype,
50
+.token.cdata {
51
+	color: #aaa;
52
+}
53
+
54
+.token.punctuation {
55
+	color: #999;
56
+}
57
+
58
+.namespace {
59
+	opacity: .7;
60
+}
61
+
62
+.token.property,
63
+.token.tag,
64
+.token.boolean,
65
+.token.number {
66
+	color: #0cf;
67
+}
68
+
69
+.token.selector,
70
+.token.attr-name,
71
+.token.string {
72
+	color: yellow;
73
+}
74
+
75
+.token.operator,
76
+.token.entity,
77
+.token.url,
78
+.language-css .token.string {
79
+	color: yellowgreen;
80
+}
81
+
82
+.token.atrule,
83
+.token.attr-value,
84
+.token.keyword {
85
+	color: deeppink;
86
+}
87
+
88
+
89
+.token.regex,
90
+.token.important {
91
+	color: orange;
92
+}
93
+
94
+.token.important {
95
+	font-weight: bold;
96
+}
97
+
98
+.token.entity {
99
+	cursor: help;
100
+}

+ 108
- 0
prism/themes/prism-okaidia.css View File

@@ -0,0 +1,108 @@
1
+/**
2
+ * okaidia theme for JavaScript, CSS and HTML
3
+ * Loosely based on Monokai textmate theme by http://www.monokai.nl/
4
+ * @author ocodia
5
+ */
6
+
7
+code[class*="language-"],
8
+pre[class*="language-"] {
9
+	color: #f8f8f2;
10
+	text-shadow: 0 1px rgba(0,0,0,0.3);
11
+	font-family: Consolas, Monaco, 'Andale Mono', monospace;
12
+	direction: ltr;
13
+	text-align: left;
14
+	white-space: pre;
15
+	word-spacing: normal;
16
+	
17
+	-moz-tab-size: 4;
18
+	-o-tab-size: 4;
19
+	tab-size: 4;
20
+	
21
+	-webkit-hyphens: none;
22
+	-moz-hyphens: none;
23
+	-ms-hyphens: none;
24
+	hyphens: none;
25
+}
26
+
27
+/* Code blocks */
28
+pre[class*="language-"] {
29
+	padding: 1em;
30
+	margin: .5em 0;
31
+	overflow: auto;	
32
+	border-radius: 0.3em;
33
+}
34
+
35
+:not(pre) > code[class*="language-"],
36
+pre[class*="language-"] {
37
+	background: #272822;
38
+}
39
+
40
+/* Inline code */
41
+:not(pre) > code[class*="language-"] {
42
+	padding: .1em;
43
+	border-radius: .3em;
44
+}
45
+
46
+.token.comment,
47
+.token.prolog,
48
+.token.doctype,
49
+.token.cdata {
50
+	color: slategray;
51
+}
52
+
53
+.token.punctuation {
54
+	color: #f8f8f2;
55
+}
56
+
57
+.namespace {
58
+	opacity: .7;
59
+}
60
+
61
+.token.property,
62
+.token.tag {
63
+	color: #f92672;
64
+}
65
+
66
+.token.boolean,
67
+.token.number{
68
+	color: #ae81ff;
69
+}
70
+
71
+.token.selector,
72
+.token.attr-name,
73
+.token.string {
74
+	color: #a6e22e;
75
+}
76
+
77
+
78
+.token.operator,
79
+.token.entity,
80
+.token.url,
81
+.language-css .token.string,
82
+.style .token.string {
83
+	color: #f8f8f2;
84
+}
85
+
86
+.token.atrule,
87
+.token.attr-value
88
+{
89
+	color: #e6db74;
90
+}
91
+
92
+
93
+.token.keyword{
94
+color: #66d9ef;
95
+}
96
+
97
+.token.regex,
98
+.token.important {
99
+	color: #fd971f;
100
+}
101
+
102
+.token.important {
103
+	font-weight: bold;
104
+}
105
+
106
+.token.entity {
107
+	cursor: help;
108
+}

+ 107
- 0
prism/themes/prism-tomorrow.css View File

@@ -0,0 +1,107 @@
1
+/**
2
+ * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML
3
+ * Based on https://github.com/chriskempson/tomorrow-theme
4
+ * @author Rose Pritchard
5
+ */
6
+
7
+code[class*="language-"],
8
+pre[class*="language-"] {
9
+  color: #ccc;
10
+  font-family: Consolas, Monaco, 'Andale Mono', monospace;
11
+  direction: ltr;
12
+  text-align: left;
13
+  white-space: pre;
14
+  word-spacing: normal;
15
+
16
+  -moz-tab-size: 4;
17
+  -o-tab-size: 4;
18
+  tab-size: 4;
19
+
20
+  -webkit-hyphens: none;
21
+  -moz-hyphens: none;
22
+  -ms-hyphens: none;
23
+  hyphens: none;
24
+
25
+}
26
+
27
+/* Code blocks */
28
+pre[class*="language-"] {
29
+  padding: 1em;
30
+  margin: .5em 0;
31
+  overflow: auto;
32
+}
33
+
34
+:not(pre) > code[class*="language-"],
35
+pre[class*="language-"] {
36
+  background: #2d2d2d;
37
+}
38
+
39
+/* Inline code */
40
+:not(pre) > code[class*="language-"] {
41
+  padding: .1em;
42
+  border-radius: .3em;
43
+}
44
+
45
+.token.comment,
46
+.token.block-comment,
47
+.token.prolog,
48
+.token.doctype,
49
+.token.cdata {
50
+  color: #999;
51
+}
52
+
53
+.token.punctuation {
54
+  color: #ccc;
55
+}
56
+
57
+
58
+.token.tag,
59
+.token.attr-name,
60
+.token.namespace {
61
+  color: #e2777a;
62
+}
63
+
64
+.token.function-name {
65
+  color: #6196cc;
66
+}
67
+
68
+
69
+.token.boolean,
70
+.token.number,
71
+.token.function {
72
+  color: #f08d49;
73
+}
74
+
75
+.token.property,
76
+.token.class-name  {
77
+  color: #f8c555;
78
+}
79
+
80
+.token.selector,
81
+.token.important,
82
+.token.atrule,
83
+.token.keyword {
84
+  color: #cc99cd;
85
+}
86
+
87
+.token.string,
88
+.token.attr-value,
89
+.token.regex {
90
+  color: #7ec699;
91
+}
92
+
93
+.token.operator,
94
+.token.entity,
95
+.token.url
96
+{
97
+  color: #67cdcc;
98
+}
99
+
100
+
101
+.token.important {
102
+  font-weight: bold;
103
+}
104
+
105
+.token.entity {
106
+  cursor: help;
107
+}

+ 172
- 0
prism/themes/prism-twilight.css View File

@@ -0,0 +1,172 @@
1
+/**
2
+ * prism.js Twilight theme
3
+ * Based (more or less) on the Twilight theme originally of Textmate fame.
4
+ * @author Remy Bach
5
+ */
6
+code[class*="language-"],
7
+pre[class*="language-"] {
8
+	color: white;
9
+	direction: ltr;
10
+	font-family: Consolas, Monaco, 'Andale Mono', monospace;
11
+	text-align: left;
12
+	text-shadow: 0 -.1em .2em black;
13
+	white-space: pre;
14
+	word-spacing: normal;
15
+	
16
+	-moz-tab-size: 4;
17
+	-o-tab-size: 4;
18
+	tab-size: 4;
19
+	
20
+	-webkit-hyphens: none;
21
+	-moz-hyphens: none;
22
+	-ms-hyphens: none;
23
+	hyphens: none;
24
+}
25
+
26
+pre[class*="language-"],
27
+:not(pre) > code[class*="language-"] {
28
+	background:hsl(0, 0%, 8%); /* #141414 */
29
+}
30
+
31
+/* Code blocks */
32
+pre[class*="language-"] {
33
+	border-radius: .5em;
34
+	border: .3em solid hsl(0,0%,33%); /* #282A2B */
35
+	box-shadow: 1px 1px .5em black inset;
36
+	margin: .5em 0;
37
+	overflow: auto;	
38
+	padding: 1em;
39
+}
40
+pre[class*="language-"]::selection { /* Safari */
41
+	background:hsl(200, 4%, 16%); /* #282A2B */
42
+}
43
+pre[class*="language-"]::selection { /* Firefox */
44
+	background:hsl(200, 4%, 16%); /* #282A2B */
45
+}
46
+
47
+/* Inline code */
48
+:not(pre) > code[class*="language-"] {
49
+	border-radius: .3em;
50
+	border: .13em solid hsl(0,0%,33%); /* #545454 */
51
+	box-shadow: 1px 1px .3em -.1em black inset;
52
+	padding: .15em .2em .05em;
53
+}
54
+
55
+.token.comment,
56
+.token.prolog,
57
+.token.doctype,
58
+.token.cdata {
59
+	color: hsl(0, 0%, 47%); /* #777777 */
60
+}
61
+
62
+.token.punctuation {
63
+	opacity: .7;
64
+}
65
+
66
+.namespace {
67
+	opacity: .7;
68
+}
69
+
70
+.token.tag,
71
+.token.boolean,
72
+.token.number {
73
+	color: hsl(14, 58%, 55%); /* #CF6A4C */
74
+}
75
+
76
+.token.keyword,
77
+.token.property,
78
+.token.selector {
79
+	color:hsl(53, 89%, 79%); /* #F9EE98 */
80
+}
81
+.token.attr-name,
82
+.token.attr-value,
83
+.token.string,
84
+.token.operator,
85
+.token.entity,
86
+.token.url,
87
+.language-css .token.string,
88
+.style .token.string {
89
+	color:hsl(76, 21%, 52%); /* #8F9D6A */
90
+}
91
+
92
+.token.atrule {
93
+	color:hsl(218, 22%, 55%); /* #7587A6 */
94
+}
95
+
96
+.token.regex,
97
+.token.important {
98
+	color: hsl(42, 75%, 65%); /* #E9C062 */
99
+}
100
+
101
+.token.important {
102
+	font-weight: bold;
103
+}
104
+
105
+.token.entity {
106
+	cursor: help;
107
+}
108
+pre[data-line] {
109
+	padding: 1em 0 1em 3em;
110
+	position: relative;
111
+}
112
+
113
+/* Markup */
114
+.language-markup .token.tag,
115
+.language-markup .token.attr-name,
116
+.language-markup .token.punctuation  {
117
+	color: hsl(33, 33%, 52%); /* #AC885B */
118
+}
119
+
120
+/* Text Selection colour */
121
+::selection {
122
+	background: hsla(0,0%,93%,0.15); /* #EDEDED */
123
+}
124
+::-moz-selection {
125
+	background: hsla(0,0%,93%,0.15); /* #EDEDED */
126
+}
127
+
128
+/* Make the tokens sit above the line highlight so the colours don't look faded. */
129
+.token {
130
+	position:relative;
131
+	z-index:1;
132
+}
133
+.line-highlight {
134
+	background: -moz-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */
135
+	background: -o-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */
136
+	background: -webkit-linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */
137
+	background: hsla(0, 0%, 33%, 0.25); /* #545454 */
138
+	background: linear-gradient(left, hsl(0, 0%, 33%,.1) 70%, hsl(0, 0%, 33%,0)); /* #545454 */
139
+	border-bottom:1px dashed hsl(0, 0%, 33%); /* #545454 */
140
+	border-top:1px dashed hsl(0, 0%, 33%); /* #545454 */
141
+	left: 0;
142
+	line-height: inherit;
143
+	margin-top: 0.75em; /* Same as .prism’s padding-top */
144
+	padding: inherit 0;
145
+	pointer-events: none;
146
+	position: absolute;
147
+	right: 0;
148
+	white-space: pre;
149
+	z-index:0;
150
+}
151
+.line-highlight:before,
152
+.line-highlight[data-end]:after {
153
+	background-color: hsl(215, 15%, 59%); /* #8794A6 */
154
+	border-radius: 999px;
155
+	box-shadow: 0 1px white;
156
+	color: hsl(24, 20%, 95%); /* #F5F2F0 */
157
+	content: attr(data-start);
158
+	font: bold 65%/1.5 sans-serif;
159
+	left: .6em;
160
+	min-width: 1em;
161
+	padding: 0 .5em;
162
+	position: absolute;
163
+	text-align: center;
164
+	text-shadow: none;
165
+	top: .4em;
166
+	vertical-align: .3em;
167
+}
168
+.line-highlight[data-end]:after {
169
+	bottom: .4em;
170
+	content: attr(data-end);
171
+	top: auto;
172
+}

Loading…
Cancel
Save