markdown-rails 2.0.0.alpha6 → 2.0.0.alpha8

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: a73a2cd07081bf36de70e5c18725718b4d327eb18f1db995099d9c564482f6ad
4
- data.tar.gz: 856e66e13c5626612f7fdb5f316be468434a35d957091105385bc918736b18b6
3
+ metadata.gz: 4cc5654ddf4c2621a0f1f25c9de3cc177b1ca02d6a47c3c23550b426eb5c1f0f
4
+ data.tar.gz: 672879f00b880bdc35f9bb79fad4ac0fdacfcf85fea5abb96ded0e773a77c90f
5
5
  SHA512:
6
- metadata.gz: 4eebf6fff67b29243d5614f7fe1549944e47dd5706cf7619d1379e04d9bd3fced54a2d95fad00608fc25eebe28393650b3ba6281365114fd6bc5c225dc5a1b08
7
- data.tar.gz: 9bd2367ed850cea192c4e06cdd9f774af84b4d51fe066de1a760e597fecea3bc166f03931d6200b624daf443089ada93c76950270be6e358a27953397a6954fd
6
+ metadata.gz: 2de8d3c2ed3febe65b4fe72ce05e52eb98005f32cf319e6bf8b33e68e5ad27725325c0cdb400d70ae69e28db0242b137a9f76d061fb519a0acd746b5dd6af737
7
+ data.tar.gz: 7fbd9f25952aeba219bce5726c0e37de27bec2d77f3187363abdc06e840a57f237b5ba9f00b916f40530e3fafafd076642c7cb8e9630cf92382b95e5fe68bccb
@@ -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,5 @@
1
+ require "redcarpet"
2
+
1
3
  module MarkdownRails
2
4
  module Renderer
3
5
  class Base < Redcarpet::Render::HTML
@@ -1,3 +1,3 @@
1
1
  module MarkdownRails
2
- VERSION = "2.0.0.alpha6"
2
+ VERSION = "2.0.0.alpha8"
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.alpha8
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-21 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.