highlighting 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 246dc393da2127a8c1c3af4de7e5ffab789f1cb8
4
- data.tar.gz: 15110c361ae615b52360b4d6ffdd60367a655a93
3
+ metadata.gz: 204053f1c717db58034721aa40f737528cddce61
4
+ data.tar.gz: efb1264e2ede9c2d098eb5a877871655c283401f
5
5
  SHA512:
6
- metadata.gz: 8b1701b50ef671cd1e8b10faf088d59dfca3a8a645d4620b3e815f617c253d6775935224ac4d51932fced6d9a20a481a5fb580ae5a2c4e2f223bf00ed7d0f460
7
- data.tar.gz: 50552c34b23d3afd3eb140fa98ddb258b7652eda1e73d06aae45765b172c2d6adaefa54511218fa77fcd41fb0826973e69e8278f59effe7221178bff53a77fa8
6
+ metadata.gz: 8903d486c0dc71dff282bd9e7417bdfcb823838bd06ce1d5e18a73a225728bd155ad102b8e859af33c1ee11935fb28bc7a8420fe9dc183dd396b9bfad0dd73ad
7
+ data.tar.gz: f0eb6f710a89a3c8d2e56789a81715e7d1c1ca0c7978313ba1c8dada4723f58c4e795019202e635b842b940ff02e894a97d2d7849847eeb27f74f9fb4d24ef07
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Bryan Lim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,22 +1,12 @@
1
1
  # Highlighting
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/highlighting`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Highlighting is based on [PrismJS](http://prismjs.com).
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ > Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from Dabblet.
6
6
 
7
- ## Installation
8
-
9
-
10
- ```
11
- <%= syntax "
12
-
13
- // Type anything.
14
-
15
- // this will be rendered accordingly
16
-
17
- "%>
18
- ```
7
+ To use highlighting, please read this [stackoverflow post](http://stackoverflow.com/a/34373693/388280)
19
8
 
9
+ ## Installation
20
10
 
21
11
  Add this line to your application's Gemfile:
22
12
 
@@ -26,15 +16,26 @@ gem 'highlighting'
26
16
 
27
17
  And then execute:
28
18
 
29
- $ bundle
19
+ ```
20
+ $ bundle
21
+ ```
30
22
 
31
23
  Or install it yourself as:
32
24
 
33
- $ gem install highlighting
25
+ ```
26
+ $ gem install highlighting
27
+ ```
34
28
 
35
29
  ## Usage
36
30
 
37
- TODO: Write usage instructions here
31
+ ```
32
+ <pre>
33
+ <code class="language-ruby">
34
+ <!-- type any ruby code you like -->
35
+ </code>
36
+ </pre>
37
+
38
+ ```
38
39
 
39
40
  ## Development
40
41
 
@@ -44,9 +45,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
44
45
 
45
46
  ## Contributing
46
47
 
47
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/highlighting. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
48
-
48
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ytbryan/highlighting. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
49
49
 
50
50
  ## License
51
51
 
52
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
52
+ Highlighting is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,3 +1,3 @@
1
1
  module Highlighting
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -15,7 +15,8 @@ var _self = (typeof window !== 'undefined')
15
15
  var Prism = (function(){
16
16
 
17
17
  // Private helper vars
18
- var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
18
+ var lang = /\blang(?:uage)?-(\w+)\b/i;
19
+ var uniqueId = 0;
19
20
 
20
21
  var _ = _self.Prism = {
21
22
  util: {
@@ -33,6 +34,13 @@ var _ = _self.Prism = {
33
34
  return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
34
35
  },
35
36
 
37
+ objId: function (obj) {
38
+ if (!obj['__id']) {
39
+ Object.defineProperty(obj, '__id', { value: ++uniqueId });
40
+ }
41
+ return obj['__id'];
42
+ },
43
+
36
44
  // Deep clone a language definition (e.g. to extend it)
37
45
  clone: function (o) {
38
46
  var type = _.util.type(o);
@@ -125,16 +133,19 @@ var _ = _self.Prism = {
125
133
  },
126
134
 
127
135
  // Traverse a language definition with Depth First Search
128
- DFS: function(o, callback, type) {
136
+ DFS: function(o, callback, type, visited) {
137
+ visited = visited || {};
129
138
  for (var i in o) {
130
139
  if (o.hasOwnProperty(i)) {
131
140
  callback.call(o, i, o[i], type || i);
132
141
 
133
- if (_.util.type(o[i]) === 'Object') {
134
- _.languages.DFS(o[i], callback);
142
+ if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
143
+ visited[_.util.objId(o[i])] = true;
144
+ _.languages.DFS(o[i], callback, null, visited);
135
145
  }
136
- else if (_.util.type(o[i]) === 'Array') {
137
- _.languages.DFS(o[i], callback, i);
146
+ else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
147
+ visited[_.util.objId(o[i])] = true;
148
+ _.languages.DFS(o[i], callback, i, visited);
138
149
  }
139
150
  }
140
151
  }
@@ -407,10 +418,8 @@ if (!_self.document) {
407
418
  return _self.Prism;
408
419
  }
409
420
 
410
- // Get current script and highlight
411
- var script = document.getElementsByTagName('script');
412
-
413
- script = script[script.length - 1];
421
+ //Get current script and highlight
422
+ var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
414
423
 
415
424
  if (script) {
416
425
  _.filename = script.src;
@@ -1 +1 @@
1
- var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==n)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),l=0;a=r[l++];)t.highlightElement(a,e===!0,n)},highlightElement:function(n,a,r){for(var l,i,o=n;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1],i=t.languages[l]),n.className=n.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=n.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=n.textContent,u={element:n,language:l,grammar:i,code:s};if(!s||!i)return t.hooks.run("complete",u),void 0;if(t.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(n),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},highlight:function(e,a,r){var l=t.tokenize(e,a);return n.stringify(t.util.encode(l),r)},tokenize:function(e,n){var a=t.Token,r=[e],l=n.rest;if(l){for(var i in l)n[i]=l[i];delete n.rest}e:for(var i in n)if(n.hasOwnProperty(i)&&n[i]){var o=n[i];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),P=[p,1];b&&P.push(b);var A=new a(i,g?t.tokenize(m,g):m,h);P.push(A),w&&P.push(w),Array.prototype.splice.apply(r,P)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var l={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}t.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,l=n.immediateClose;_self.postMessage(t.highlight(r,t.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
1
+ var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=n.util.type(e);switch(t){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=n.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return n.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){r=r||n.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);o[s]=i[s]}return n.languages.DFS(n.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,t,a,r){r=r||{};for(var i in e)e.hasOwnProperty(i)&&(t.call(e,i,e[i],a||i),"Object"!==n.util.type(e[i])||r[n.util.objId(e[i])]?"Array"!==n.util.type(e[i])||r[n.util.objId(e[i])]||(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,i,r)):(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,null,r)))}},plugins:{},highlightAll:function(e,t){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0;a=r[i++];)n.highlightElement(a,e===!0,t)},highlightElement:function(t,a,r){for(var i,l,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(i=(o.className.match(e)||[,""])[1],l=n.languages[i]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+i,o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+i);var s=t.textContent,u={element:t,language:i,grammar:l,code:s};if(!s||!l)return n.hooks.run("complete",u),void 0;if(n.hooks.run("before-highlight",u),a&&_self.Worker){var c=new Worker(n.filename);c.onmessage=function(e){u.highlightedCode=e.data,n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=n.highlight(u.code,u.grammar,u.language),n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(t),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},highlight:function(e,t,r){var i=n.tokenize(e,t);return a.stringify(n.util.encode(i),r)},tokenize:function(e,t){var a=n.Token,r=[e],i=t.rest;if(i){for(var l in i)t[l]=i[l];delete t.rest}e:for(var l in t)if(t.hasOwnProperty(l)&&t[l]){var o=t[l];o="Array"===n.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],c=u.inside,g=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){g&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,b=y+v,k=d.slice(0,y+1),w=d.slice(b+1),_=[p,1];k&&_.push(k);var P=new a(l,c?n.tokenize(m,c):m,h);_.push(P),w&&_.push(w),Array.prototype.splice.apply(r,_)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=(o?" ":"")+s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+o+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",n.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
@@ -0,0 +1,11 @@
1
+ Prism.languages.json = {
2
+ 'property': /".*?"(?=\s*:)/ig,
3
+ 'string': /"(?!:)(\\?[^"])*?"(?!:)/g,
4
+ 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,
5
+ 'punctuation': /[{}[\]);,]/g,
6
+ 'operator': /:/g,
7
+ 'boolean': /\b(true|false)\b/gi,
8
+ 'null': /\bnull\b/gi,
9
+ };
10
+
11
+ Prism.languages.jsonp = Prism.languages.json;
@@ -0,0 +1 @@
1
+ Prism.languages.json={property:/".*?"(?=\s*:)/gi,string:/"(?!:)(\\?[^"])*?"(?!:)/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,punctuation:/[{}[\]);,]/g,operator:/:/g,"boolean":/\b(true|false)\b/gi,"null":/\bnull\b/gi},Prism.languages.jsonp=Prism.languages.json;
@@ -3,20 +3,23 @@
3
3
  var javascript = Prism.util.clone(Prism.languages.javascript);
4
4
 
5
5
  Prism.languages.jsx = Prism.languages.extend('markup', javascript);
6
- Prism.languages.jsx.tag.pattern= /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i;
6
+ Prism.languages.jsx.tag.pattern= /<\/?[\w\.:-]+\s*(?:\s+[\w\.:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i;
7
7
 
8
8
  Prism.languages.jsx.tag.inside['attr-value'].pattern = /=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i;
9
9
 
10
+ var jsxExpression = Prism.util.clone(Prism.languages.jsx);
11
+
12
+ delete jsxExpression.punctuation
13
+
14
+ jsxExpression = Prism.languages.insertBefore('jsx', 'operator', {
15
+ 'punctuation': /=(?={)|[{}[\];(),.:]/
16
+ }, { jsx: jsxExpression });
17
+
10
18
  Prism.languages.insertBefore('inside', 'attr-value',{
11
19
  'script': {
12
20
  // Allow for one level of nesting
13
21
  pattern: /=(\{(?:\{[^}]*\}|[^}])+\})/i,
14
- inside: {
15
- 'function' : Prism.languages.javascript.function,
16
- 'punctuation': /[={}[\];(),.:]/,
17
- 'keyword': Prism.languages.javascript.keyword,
18
- 'boolean': Prism.languages.javascript.boolean
19
- },
22
+ inside: jsxExpression,
20
23
  'alias': 'language-javascript'
21
24
  }
22
25
  }, Prism.languages.jsx.tag);
@@ -1 +1 @@
1
- !function(a){var s=a.util.clone(a.languages.javascript);a.languages.jsx=a.languages.extend("markup",s),a.languages.jsx.tag.pattern=/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i,a.languages.jsx.tag.inside["attr-value"].pattern=/=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i,a.languages.insertBefore("inside","attr-value",{script:{pattern:/=(\{(?:\{[^}]*\}|[^}])+\})/i,inside:{"function":a.languages.javascript.function,punctuation:/[={}[\];(),.:]/,keyword:a.languages.javascript.keyword,"boolean":a.languages.javascript.boolean},alias:"language-javascript"}},a.languages.jsx.tag)}(Prism);
1
+ !function(a){var e=a.util.clone(a.languages.javascript);a.languages.jsx=a.languages.extend("markup",e),a.languages.jsx.tag.pattern=/<\/?[\w\.:-]+\s*(?:\s+[\w\.:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i,a.languages.jsx.tag.inside["attr-value"].pattern=/=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i;var s=a.util.clone(a.languages.jsx);delete s.punctuation,s=a.languages.insertBefore("jsx","operator",{punctuation:/=(?={)|[{}[\];(),.:]/},{jsx:s}),a.languages.insertBefore("inside","attr-value",{script:{pattern:/=(\{(?:\{[^}]*\}|[^}])+\})/i,inside:s,alias:"language-javascript"}},a.languages.jsx.tag)}(Prism);
@@ -7,6 +7,7 @@
7
7
  code[class*="language-"],
8
8
  pre[class*="language-"] {
9
9
  color: black;
10
+ background: none;
10
11
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
11
12
  direction: ltr;
12
13
  text-align: left;
@@ -43,7 +44,6 @@ pre[class*="language-"] {
43
44
  background-size: 3em 3em;
44
45
  background-origin: content-box;
45
46
  overflow: visible;
46
- max-height: 30em;
47
47
  padding: 0;
48
48
  }
49
49
 
@@ -90,6 +90,7 @@ pre[class*="language-"]:after {
90
90
  left: 0.18em;
91
91
  width: 40%;
92
92
  height: 20%;
93
+ max-height: 13em;
93
94
  -webkit-box-shadow: 0px 13px 8px #979797;
94
95
  -moz-box-shadow: 0px 13px 8px #979797;
95
96
  box-shadow: 0px 13px 8px #979797;
@@ -7,6 +7,7 @@
7
7
  code[class*="language-"],
8
8
  pre[class*="language-"] {
9
9
  color: white;
10
+ background: none;
10
11
  text-shadow: 0 -.1em .2em black;
11
12
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
12
13
  direction: ltr;
@@ -7,6 +7,7 @@
7
7
  code[class*="language-"],
8
8
  pre[class*="language-"] {
9
9
  color: #f8f8f2;
10
+ background: none;
10
11
  text-shadow: 0 1px rgba(0, 0, 0, 0.3);
11
12
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
12
13
  direction: ltr;
@@ -0,0 +1,149 @@
1
+ /*
2
+ Solarized Color Schemes originally by Ethan Schoonover
3
+ http://ethanschoonover.com/solarized
4
+
5
+ Ported for PrismJS by Hector Matos
6
+ Website: https://krakendev.io
7
+ Twitter Handle: https://twitter.com/allonsykraken)
8
+ */
9
+
10
+ /*
11
+ SOLARIZED HEX
12
+ --------- -------
13
+ base03 #002b36
14
+ base02 #073642
15
+ base01 #586e75
16
+ base00 #657b83
17
+ base0 #839496
18
+ base1 #93a1a1
19
+ base2 #eee8d5
20
+ base3 #fdf6e3
21
+ yellow #b58900
22
+ orange #cb4b16
23
+ red #dc322f
24
+ magenta #d33682
25
+ violet #6c71c4
26
+ blue #268bd2
27
+ cyan #2aa198
28
+ green #859900
29
+ */
30
+
31
+ code[class*="language-"],
32
+ pre[class*="language-"] {
33
+ color: #657b83; /* base00 */
34
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
35
+ direction: ltr;
36
+ text-align: left;
37
+ white-space: pre;
38
+ word-spacing: normal;
39
+ word-break: normal;
40
+ word-wrap: normal;
41
+
42
+ line-height: 1.5;
43
+
44
+ -moz-tab-size: 4;
45
+ -o-tab-size: 4;
46
+ tab-size: 4;
47
+
48
+ -webkit-hyphens: none;
49
+ -moz-hyphens: none;
50
+ -ms-hyphens: none;
51
+ hyphens: none;
52
+ }
53
+
54
+ pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
55
+ code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
56
+ background: #073642; /* base02 */
57
+ }
58
+
59
+ pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
60
+ code[class*="language-"]::selection, code[class*="language-"] ::selection {
61
+ background: #073642; /* base02 */
62
+ }
63
+
64
+ /* Code blocks */
65
+ pre[class*="language-"] {
66
+ padding: 1em;
67
+ margin: .5em 0;
68
+ overflow: auto;
69
+ border-radius: 0.3em;
70
+ }
71
+
72
+ :not(pre) > code[class*="language-"],
73
+ pre[class*="language-"] {
74
+ background-color: #fdf6e3; /* base3 */
75
+ }
76
+
77
+ /* Inline code */
78
+ :not(pre) > code[class*="language-"] {
79
+ padding: .1em;
80
+ border-radius: .3em;
81
+ }
82
+
83
+ .token.comment,
84
+ .token.prolog,
85
+ .token.doctype,
86
+ .token.cdata {
87
+ color: #93a1a1; /* base1 */
88
+ }
89
+
90
+ .token.punctuation {
91
+ color: #586e75; /* base01 */
92
+ }
93
+
94
+ .namespace {
95
+ opacity: .7;
96
+ }
97
+
98
+ .token.property,
99
+ .token.tag,
100
+ .token.boolean,
101
+ .token.number,
102
+ .token.constant,
103
+ .token.symbol,
104
+ .token.deleted {
105
+ color: #268bd2; /* blue */
106
+ }
107
+
108
+ .token.selector,
109
+ .token.attr-name,
110
+ .token.string,
111
+ .token.char,
112
+ .token.builtin,
113
+ .token.url,
114
+ .token.inserted {
115
+ color: #2aa198; /* cyan */
116
+ }
117
+
118
+ .token.entity {
119
+ color: #657b83; /* base00 */
120
+ background: #eee8d5; /* base2 */
121
+ }
122
+
123
+ .token.atrule,
124
+ .token.attr-value,
125
+ .token.keyword {
126
+ color: #859900; /* green */
127
+ }
128
+
129
+ .token.function {
130
+ color: #b58900; /* yellow */
131
+ }
132
+
133
+ .token.regex,
134
+ .token.important,
135
+ .token.variable {
136
+ color: #cb4b16; /* orange */
137
+ }
138
+
139
+ .token.important,
140
+ .token.bold {
141
+ font-weight: bold;
142
+ }
143
+ .token.italic {
144
+ font-style: italic;
145
+ }
146
+
147
+ .token.entity {
148
+ cursor: help;
149
+ }
@@ -7,6 +7,7 @@
7
7
  code[class*="language-"],
8
8
  pre[class*="language-"] {
9
9
  color: #ccc;
10
+ background: none;
10
11
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
11
12
  direction: ltr;
12
13
  text-align: left;
@@ -6,6 +6,7 @@
6
6
  code[class*="language-"],
7
7
  pre[class*="language-"] {
8
8
  color: white;
9
+ background: none;
9
10
  direction: ltr;
10
11
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
11
12
  text-align: left;
@@ -41,13 +42,13 @@ pre[class*="language-"] {
41
42
  padding: 1em;
42
43
  }
43
44
 
44
- pre[class*="language-"]::selection {
45
- /* Safari */
45
+ pre[class*="language-"]::-moz-selection {
46
+ /* Firefox */
46
47
  background: hsl(200, 4%, 16%); /* #282A2B */
47
48
  }
48
49
 
49
50
  pre[class*="language-"]::selection {
50
- /* Firefox */
51
+ /* Safari */
51
52
  background: hsl(200, 4%, 16%); /* #282A2B */
52
53
  }
53
54
 
@@ -7,6 +7,7 @@
7
7
  code[class*="language-"],
8
8
  pre[class*="language-"] {
9
9
  color: black;
10
+ background: none;
10
11
  text-shadow: 0 1px white;
11
12
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
12
13
  direction: ltr;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highlighting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bryan lim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-19 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - LICENSE
48
49
  - README.md
49
50
  - app/helpers/syntax_helper.rb
50
51
  - lib/highlighting.rb
@@ -147,6 +148,8 @@ files:
147
148
  - vendor/assets/javascripts/prism-java.min.js
148
149
  - vendor/assets/javascripts/prism-javascript.js
149
150
  - vendor/assets/javascripts/prism-javascript.min.js
151
+ - vendor/assets/javascripts/prism-json.js
152
+ - vendor/assets/javascripts/prism-json.min.js
150
153
  - vendor/assets/javascripts/prism-jsx.js
151
154
  - vendor/assets/javascripts/prism-jsx.min.js
152
155
  - vendor/assets/javascripts/prism-julia.js
@@ -276,6 +279,7 @@ files:
276
279
  - vendor/assets/stylesheets/prism-dark.css
277
280
  - vendor/assets/stylesheets/prism-funky.css
278
281
  - vendor/assets/stylesheets/prism-okaidia.css
282
+ - vendor/assets/stylesheets/prism-solarizedlight.css
279
283
  - vendor/assets/stylesheets/prism-tomorrow.css
280
284
  - vendor/assets/stylesheets/prism-twilight.css
281
285
  - vendor/assets/stylesheets/prism.css
@@ -299,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
303
  version: '0'
300
304
  requirements: []
301
305
  rubyforge_project:
302
- rubygems_version: 2.4.5.1
306
+ rubygems_version: 2.5.1
303
307
  signing_key:
304
308
  specification_version: 4
305
309
  summary: Syntax Highlighting for Rails using PrismJS.