markdown-rails 2.0.0.alpha6 → 2.0.0.alpha7

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
  SHA256:
3
- metadata.gz: a73a2cd07081bf36de70e5c18725718b4d327eb18f1db995099d9c564482f6ad
4
- data.tar.gz: 856e66e13c5626612f7fdb5f316be468434a35d957091105385bc918736b18b6
3
+ metadata.gz: 9dde98979d1982cf68293e37a1567a937c3dca92d16476ff4049e5e69dfa8357
4
+ data.tar.gz: 6fbd6128db8e456919bddacc8abc2127cf870d686b454aac21a9406a87a99bfa
5
5
  SHA512:
6
- metadata.gz: 4eebf6fff67b29243d5614f7fe1549944e47dd5706cf7619d1379e04d9bd3fced54a2d95fad00608fc25eebe28393650b3ba6281365114fd6bc5c225dc5a1b08
7
- data.tar.gz: 9bd2367ed850cea192c4e06cdd9f774af84b4d51fe066de1a760e597fecea3bc166f03931d6200b624daf443089ada93c76950270be6e358a27953397a6954fd
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.alpha6"
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.alpha6
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
@@ -58,6 +58,7 @@ files:
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.