markdown-rails 2.0.0.alpha6 → 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dde98979d1982cf68293e37a1567a937c3dca92d16476ff4049e5e69dfa8357
|
4
|
+
data.tar.gz: 6fbd6128db8e456919bddacc8abc2127cf870d686b454aac21a9406a87a99bfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.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-
|
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.
|
90
|
+
rubygems_version: 3.3.20
|
90
91
|
signing_key:
|
91
92
|
specification_version: 4
|
92
93
|
summary: Markdown templates and partials in Rails.
|