highlighting 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -8
- data/app/helpers/syntax_helper.rb +4 -0
- data/lib/highlighting/post_message.rb +22 -0
- data/lib/highlighting/version.rb +1 -1
- data/vendor/assets/javascripts/prism-turbolinks.js +5 -0
- metadata +10 -5
- data/LICENSE +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a91cd326a58f0bf9c6fa2e02fd9da5ae3a07f13
|
4
|
+
data.tar.gz: b5db690c5a54d12385bbe12bc9d6b89576c9237a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcbfc9363c70920b181271852de51246b79551bfd1b8678021deed754d91ab62b59962ccd35a19858064d16aac0d6a61439ba7dd191d34e2811028dcaa1e2f54
|
7
|
+
data.tar.gz: 996c368f3e7f2c5d6044cfd1be83038ea7039bff1b0004fe5cbe5898f4343c18c6264aa14fb9a03db7b5fa7a98dc09870747393df4b140d388d2b02f62ca3f05
|
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
# Highlighting
|
2
2
|
|
3
|
-
Highlighting
|
3
|
+
Highlighting ships with [PrismJS](http://prismjs.com).
|
4
4
|
|
5
5
|
> Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from Dabblet.
|
6
6
|
|
7
|
-
To use highlighting, please read this [stackoverflow post](http://stackoverflow.com/a/34373693/388280)
|
8
|
-
|
9
7
|
## Installation
|
10
8
|
|
11
9
|
Add this line to your application's Gemfile:
|
@@ -26,17 +24,54 @@ Or install it yourself as:
|
|
26
24
|
$ gem install highlighting
|
27
25
|
```
|
28
26
|
|
27
|
+
At application.js, replace [language] with the name of language. For example: prism-ruby or prism-coffeescript
|
28
|
+
```
|
29
|
+
//= require jquery
|
30
|
+
//= require jquery_ujs
|
31
|
+
//= require turbolinks
|
32
|
+
//= require prism
|
33
|
+
//= require prism-[language]
|
34
|
+
//= require prism-turbolinks #optional
|
35
|
+
//= require_tree .
|
36
|
+
```
|
37
|
+
|
38
|
+
At application.css, add `*= require prism-[theme]` or use the default `*= require prism`
|
39
|
+
|
40
|
+
```
|
41
|
+
*= require_tree .
|
42
|
+
*= require prism-[theme]
|
43
|
+
*= require_self
|
44
|
+
```
|
45
|
+
There are various other themes to choose from. For example `*= require prism-tomorrow`, `*= require prism-twilight`.
|
46
|
+
|
47
|
+
|
29
48
|
## Usage
|
49
|
+
Use the alias in place of xxxx in `language-xxxx`. `language-xxxx` is a css rule here used by prismjs.
|
50
|
+
|
51
|
+
For example: ruby, python, go, swift
|
30
52
|
|
31
53
|
```
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
54
|
+
<%= code "language-ruby" %>
|
55
|
+
<!-- type any ruby code you like -->
|
56
|
+
<% end %>
|
57
|
+
```
|
58
|
+
|
59
|
+
## Known Issues
|
37
60
|
|
61
|
+
With turbolinks enabled, prismjs is not called at page load. For quick fix, add the `//= require prism-turbolinks` line at application.js
|
62
|
+
|
63
|
+
```
|
64
|
+
//= require jquery
|
65
|
+
//= require jquery_ujs
|
66
|
+
//= require turbolinks
|
67
|
+
//= require prism
|
68
|
+
//= require prism-ruby
|
69
|
+
//= require prism-turbolinks
|
70
|
+
//= require_tree .
|
38
71
|
```
|
39
72
|
|
73
|
+
If you wish to add the code manually, read [prismjs not working with turbolinks](http://stackoverflow.com/questions/21278357/prism-js-not-working-with-rails-4-turbolinks/21355342#21355342)
|
74
|
+
|
40
75
|
## Development
|
41
76
|
|
42
77
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Log
|
2
|
+
MESSAGE = "
|
3
|
+
|
4
|
+
######################
|
5
|
+
## HIGHLIGHTING
|
6
|
+
######################
|
7
|
+
|
8
|
+
What's new in 0.1.2?
|
9
|
+
- SyntaxHelper <%= code "" %>
|
10
|
+
Usage:
|
11
|
+
<%= code \"language-ruby\" do %>
|
12
|
+
<!-- write any ruby code here !>
|
13
|
+
puts \"hello world\"
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
What's in 0.1.1?
|
17
|
+
- ship with PrismJS 1.4.1
|
18
|
+
|
19
|
+
Full Changelog -> https://github.com/ytbryan/highlighting/blob/master/changelog.md
|
20
|
+
Pull Request -> https://github.com/ytbryan/highlighting/pulls
|
21
|
+
"
|
22
|
+
end
|
data/lib/highlighting/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bryan lim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -45,10 +45,10 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- LICENSE
|
49
48
|
- README.md
|
50
49
|
- app/helpers/syntax_helper.rb
|
51
50
|
- lib/highlighting.rb
|
51
|
+
- lib/highlighting/post_message.rb
|
52
52
|
- lib/highlighting/version.rb
|
53
53
|
- vendor/assets/javascripts/prism-abap.js
|
54
54
|
- vendor/assets/javascripts/prism-abap.min.js
|
@@ -260,6 +260,7 @@ files:
|
|
260
260
|
- vendor/assets/javascripts/prism-tcl.min.js
|
261
261
|
- vendor/assets/javascripts/prism-textile.js
|
262
262
|
- vendor/assets/javascripts/prism-textile.min.js
|
263
|
+
- vendor/assets/javascripts/prism-turbolinks.js
|
263
264
|
- vendor/assets/javascripts/prism-twig.js
|
264
265
|
- vendor/assets/javascripts/prism-twig.min.js
|
265
266
|
- vendor/assets/javascripts/prism-typescript.js
|
@@ -283,11 +284,15 @@ files:
|
|
283
284
|
- vendor/assets/stylesheets/prism-tomorrow.css
|
284
285
|
- vendor/assets/stylesheets/prism-twilight.css
|
285
286
|
- vendor/assets/stylesheets/prism.css
|
286
|
-
homepage: http://github.com/ytbryan/highlighting
|
287
|
+
homepage: http://github.com/ytbryan/highlighting
|
287
288
|
licenses:
|
288
289
|
- MIT
|
289
290
|
metadata: {}
|
290
|
-
post_install_message:
|
291
|
+
post_install_message: "\n\n ######################\n ## HIGHLIGHTING\n ######################\n\n
|
292
|
+
\ What's new in 0.1.2?\n - SyntaxHelper <%= code %>\n Usage:\n <%= code \"language-ruby\"
|
293
|
+
do %>\n <!-- write any ruby code here !>\n puts \"hello world\"\n <% end
|
294
|
+
%>\n\n What's in 0.1.1?\n - ship with PrismJS 1.4.1\n\n Full Changelog -> https://github.com/ytbryan/highlighting/blob/master/changelog.md\n
|
295
|
+
\ Pull Request -> https://github.com/ytbryan/highlighting/pulls\n "
|
291
296
|
rdoc_options: []
|
292
297
|
require_paths:
|
293
298
|
- lib
|
data/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
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.
|