markdown-rails 2.0.0.alpha5 → 2.0.0.alpha7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f1b4ce5ea92d61301ed3e7d2750d9cc5db2054ca3b589f832acfde85424991
4
- data.tar.gz: 5780eab553c1dce45dae009b8edcaf6cb5c346036c38ee7f3ff6617d8a730a2f
3
+ metadata.gz: 9dde98979d1982cf68293e37a1567a937c3dca92d16476ff4049e5e69dfa8357
4
+ data.tar.gz: 6fbd6128db8e456919bddacc8abc2127cf870d686b454aac21a9406a87a99bfa
5
5
  SHA512:
6
- metadata.gz: 61a346737cb1ed980d6ad9e3d4e0454d58bc47acd031ea9a594f2359c6764b3eb00c0516fb43699d666c902876d07039b16d4910736775c702e8160a78b6c7f0
7
- data.tar.gz: 64b58bf2af05b1227ef08dc6e91b9b98568ec8c726ad2953708d573d70d8b6abf982db2baf8b52e998f863560922efe611f167db415c5c96eeb1e1dae4aabcc4
6
+ metadata.gz: eee1a1518de503366398b312b663a654d0c6aa020af1cc9742367abee6fb09852660e209a32358ba6303f0941b91a857a930fbba0127c31740f724a137e3009c
7
+ data.tar.gz: e327ca2a2ca733cc0f0e3247cc81dedea827d917fa544e667ce6068b9e7bcb26a8c0dff48c80dd79183b1d38d48e014a159cb7a80bf15b95cd1929a84b58afac
@@ -6,6 +6,9 @@ class ApplicationMarkdown < MarkdownRails::Renderer::Rails
6
6
  # and feel smarter. Read the docs at https://github.com/vmg/redcarpet#also-now-our-pants-are-much-smarter
7
7
  include Redcarpet::Render::SmartyPants
8
8
 
9
+ # Uncomment and run `bundle add rouge` for syntax highlighting
10
+ # include MarkdownRails::Helper::Rouge
11
+
9
12
  # If you need access to ActionController::Base.helpers, you can delegate by uncommenting
10
13
  # and adding to the list below. Several are already included for you in the `MarkdownRails::Renderer::Rails`,
11
14
  # but you can add more here.
@@ -0,0 +1,34 @@
1
+ require "rouge"
2
+
3
+ module MarkdownRails
4
+ module Helper
5
+ module Rouge
6
+ def rouge_theme
7
+ "gruvbox".freeze
8
+ end
9
+
10
+ def rouge_formatter
11
+ ::Rouge::Formatters::HTMLInline.new(rouge_theme)
12
+ end
13
+
14
+ def rouge_fallback_lexer
15
+ rouge_lexer "text"
16
+ end
17
+
18
+ def highlight_code(code, language)
19
+ lexer = rouge_lexer(language) || rouge_fallback_lexer
20
+ rouge_formatter.format(lexer.lex(code))
21
+ end
22
+
23
+ def block_code(code, language)
24
+ content_tag :pre, class: language do
25
+ raw highlight_code code, language
26
+ end
27
+ end
28
+
29
+ def rouge_lexer(language)
30
+ ::Rouge::Lexer.find language
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module MarkdownRails
2
- VERSION = "2.0.0.alpha5"
2
+ VERSION = "2.0.0.alpha7"
3
3
  end
@@ -15,4 +15,8 @@ module MarkdownRails
15
15
  autoload :Base, "markdown-rails/renderer/base"
16
16
  autoload :Rails, "markdown-rails/renderer/rails"
17
17
  end
18
+
19
+ module Helper
20
+ autoload :Rouge, "markdown-rails/helper/rouge"
21
+ end
18
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha5
4
+ version: 2.0.0.alpha7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2022-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -50,14 +50,15 @@ files:
50
50
  - README.md
51
51
  - Rakefile
52
52
  - app/assets/config/markdown_rails_manifest.js
53
- - lib/generators/markdown-rails/install/USAGE
54
- - lib/generators/markdown-rails/install/install_generator.rb
55
- - lib/generators/markdown-rails/install/templates/app/markdown/application_markdown.rb
56
- - lib/generators/markdown-rails/install/templates/config/initializers/markdown.rb
53
+ - lib/generators/markdown_rails/install/USAGE
54
+ - lib/generators/markdown_rails/install/install_generator.rb
55
+ - lib/generators/markdown_rails/install/templates/app/markdown/application_markdown.rb
56
+ - lib/generators/markdown_rails/install/templates/config/initializers/markdown.rb
57
57
  - lib/markdown-rails.rb
58
58
  - lib/markdown-rails/engine.rb
59
59
  - lib/markdown-rails/handler/erb.rb
60
60
  - lib/markdown-rails/handler/markdown.rb
61
+ - lib/markdown-rails/helper/rouge.rb
61
62
  - lib/markdown-rails/railtie.rb
62
63
  - lib/markdown-rails/renderer/base.rb
63
64
  - lib/markdown-rails/renderer/rails.rb
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  - !ruby/object:Gem::Version
87
88
  version: 1.3.1
88
89
  requirements: []
89
- rubygems_version: 3.3.7
90
+ rubygems_version: 3.3.20
90
91
  signing_key:
91
92
  specification_version: 4
92
93
  summary: Markdown templates and partials in Rails.