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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cc5654ddf4c2621a0f1f25c9de3cc177b1ca02d6a47c3c23550b426eb5c1f0f
|
4
|
+
data.tar.gz: 672879f00b880bdc35f9bb79fad4ac0fdacfcf85fea5abb96ded0e773a77c90f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/markdown-rails.rb
CHANGED
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.
|
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-
|
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.
|
90
|
+
rubygems_version: 3.3.20
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: Markdown templates and partials in Rails.
|