markdown_views 2.4.0 → 3.0.0
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 +4 -4
- data/Gemfile.lock +7 -8
- data/README.md +17 -11
- data/Rakefile +5 -5
- data/app/assets/stylesheets/rouge.base16.dark.css +43 -30
- data/app/assets/stylesheets/rouge.base16.light.css +42 -29
- data/app/assets/stylesheets/rouge.base16.monokai.dark.css +16 -3
- data/app/assets/stylesheets/rouge.base16.monokai.light.css +16 -3
- data/app/assets/stylesheets/rouge.base16.solarized.dark.css +16 -3
- data/app/assets/stylesheets/rouge.base16.solarized.light.css +16 -3
- data/app/assets/stylesheets/rouge.bw.css +70 -0
- data/app/assets/stylesheets/rouge.colorful.css +12 -4
- data/app/assets/stylesheets/rouge.github.dark.css +116 -0
- data/app/assets/stylesheets/rouge.github.light.css +116 -0
- data/app/assets/stylesheets/rouge.gruvbox.dark.css +16 -3
- data/app/assets/stylesheets/rouge.gruvbox.light.css +16 -3
- data/app/assets/stylesheets/rouge.igorpro.css +15 -2
- data/app/assets/stylesheets/rouge.molokai.css +8 -5
- data/app/assets/stylesheets/rouge.monokai.css +12 -5
- data/app/assets/stylesheets/rouge.monokai.sublime.css +23 -7
- data/app/assets/stylesheets/rouge.pastie.css +13 -5
- data/app/assets/stylesheets/rouge.thankful_eyes.css +13 -6
- data/app/assets/stylesheets/rouge.tulip.css +13 -6
- data/lib/markdown_views/config.rb +23 -7
- data/lib/markdown_views/handler.rb +0 -21
- data/lib/markdown_views/renderer.rb +24 -7
- data/lib/markdown_views/version.rb +1 -1
- data/lib/markdown_views.rb +2 -5
- data/markdown_views.gemspec +6 -3
- data/test/config_test.rb +69 -0
- data/test/render_test.rb +50 -0
- data/test/strip_comments_test.rb +0 -6
- data/test/test_helper.rb +16 -0
- metadata +33 -25
- data/app/assets/stylesheets/rouge.github.css +0 -209
|
@@ -12,14 +12,13 @@
|
|
|
12
12
|
color: #a8e1fe;
|
|
13
13
|
font-weight: bold;
|
|
14
14
|
}
|
|
15
|
-
.rouge-highlight .c, .rouge-highlight .cd, .rouge-highlight .cm, .rouge-highlight .c1, .rouge-highlight .cs {
|
|
15
|
+
.rouge-highlight .c, .rouge-highlight .ch, .rouge-highlight .cd, .rouge-highlight .cm, .rouge-highlight .cpf, .rouge-highlight .c1, .rouge-highlight .cs {
|
|
16
16
|
color: #6c8b9f;
|
|
17
17
|
font-style: italic;
|
|
18
18
|
}
|
|
19
19
|
.rouge-highlight .cp {
|
|
20
20
|
color: #b2fd6d;
|
|
21
21
|
font-weight: bold;
|
|
22
|
-
font-style: italic;
|
|
23
22
|
}
|
|
24
23
|
.rouge-highlight .err {
|
|
25
24
|
color: #fefeec;
|
|
@@ -50,6 +49,10 @@
|
|
|
50
49
|
.rouge-highlight .ge {
|
|
51
50
|
font-style: italic;
|
|
52
51
|
}
|
|
52
|
+
.rouge-highlight .ges {
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
font-style: italic;
|
|
55
|
+
}
|
|
53
56
|
.rouge-highlight .gs {
|
|
54
57
|
font-weight: bold;
|
|
55
58
|
}
|
|
@@ -117,7 +120,7 @@
|
|
|
117
120
|
color: #ffb000;
|
|
118
121
|
font-weight: bold;
|
|
119
122
|
}
|
|
120
|
-
.rouge-highlight .m, .rouge-highlight .
|
|
123
|
+
.rouge-highlight .m, .rouge-highlight .mb, .rouge-highlight .mf, .rouge-highlight .mh, .rouge-highlight .mi, .rouge-highlight .il, .rouge-highlight .mo, .rouge-highlight .mx {
|
|
121
124
|
color: #f696db;
|
|
122
125
|
font-weight: bold;
|
|
123
126
|
}
|
|
@@ -129,10 +132,14 @@
|
|
|
129
132
|
color: #f696db;
|
|
130
133
|
font-weight: bold;
|
|
131
134
|
}
|
|
132
|
-
.rouge-highlight .s, .rouge-highlight .sb, .rouge-highlight .sd, .rouge-highlight .s2, .rouge-highlight .sh, .rouge-highlight .sx, .rouge-highlight .sr, .rouge-highlight .s1 {
|
|
135
|
+
.rouge-highlight .s, .rouge-highlight .sb, .rouge-highlight .dl, .rouge-highlight .sd, .rouge-highlight .s2, .rouge-highlight .sh, .rouge-highlight .sx, .rouge-highlight .sr, .rouge-highlight .s1 {
|
|
133
136
|
color: #fff0a6;
|
|
134
137
|
font-weight: bold;
|
|
135
138
|
}
|
|
139
|
+
.rouge-highlight .sa {
|
|
140
|
+
color: #f6dd62;
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
}
|
|
136
143
|
.rouge-highlight .se {
|
|
137
144
|
color: #4df4ff;
|
|
138
145
|
font-weight: bold;
|
|
@@ -158,7 +165,7 @@
|
|
|
158
165
|
.rouge-highlight .go {
|
|
159
166
|
color: #BBBBBB;
|
|
160
167
|
}
|
|
161
|
-
.rouge-highlight .nf {
|
|
168
|
+
.rouge-highlight .nf, .rouge-highlight .fm {
|
|
162
169
|
color: #a8e1fe;
|
|
163
170
|
}
|
|
164
171
|
.rouge-highlight .py {
|
|
@@ -167,7 +174,7 @@
|
|
|
167
174
|
.rouge-highlight .na {
|
|
168
175
|
color: #a8e1fe;
|
|
169
176
|
}
|
|
170
|
-
.rouge-highlight .nv, .rouge-highlight .vc, .rouge-highlight .vg, .rouge-highlight .vi {
|
|
177
|
+
.rouge-highlight .nv, .rouge-highlight .vc, .rouge-highlight .vg, .rouge-highlight .vi, .rouge-highlight .vm {
|
|
171
178
|
color: #a8e1fe;
|
|
172
179
|
font-weight: bold;
|
|
173
180
|
}
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
color: #FFFFFF;
|
|
5
5
|
background-color: #231529;
|
|
6
6
|
}
|
|
7
|
-
.rouge-highlight .c, .rouge-highlight .cd, .rouge-highlight .cm, .rouge-highlight .c1, .rouge-highlight .cs {
|
|
7
|
+
.rouge-highlight .c, .rouge-highlight .ch, .rouge-highlight .cd, .rouge-highlight .cm, .rouge-highlight .cpf, .rouge-highlight .c1, .rouge-highlight .cs {
|
|
8
8
|
color: #6D6E70;
|
|
9
9
|
font-style: italic;
|
|
10
10
|
}
|
|
11
11
|
.rouge-highlight .cp {
|
|
12
12
|
color: #41ff5b;
|
|
13
13
|
font-weight: bold;
|
|
14
|
-
font-style: italic;
|
|
15
14
|
}
|
|
16
15
|
.rouge-highlight .err {
|
|
17
16
|
color: #FFFFFF;
|
|
@@ -40,6 +39,10 @@
|
|
|
40
39
|
.rouge-highlight .ge {
|
|
41
40
|
font-style: italic;
|
|
42
41
|
}
|
|
42
|
+
.rouge-highlight .ges {
|
|
43
|
+
font-weight: bold;
|
|
44
|
+
font-style: italic;
|
|
45
|
+
}
|
|
43
46
|
.rouge-highlight .gs {
|
|
44
47
|
font-weight: bold;
|
|
45
48
|
}
|
|
@@ -111,7 +114,7 @@
|
|
|
111
114
|
color: #9f93e6;
|
|
112
115
|
font-weight: bold;
|
|
113
116
|
}
|
|
114
|
-
.rouge-highlight .m, .rouge-highlight .
|
|
117
|
+
.rouge-highlight .m, .rouge-highlight .mb, .rouge-highlight .mf, .rouge-highlight .mh, .rouge-highlight .mi, .rouge-highlight .il, .rouge-highlight .mo, .rouge-highlight .mx {
|
|
115
118
|
color: #9f93e6;
|
|
116
119
|
font-weight: bold;
|
|
117
120
|
}
|
|
@@ -123,10 +126,14 @@
|
|
|
123
126
|
color: #9f93e6;
|
|
124
127
|
font-weight: bold;
|
|
125
128
|
}
|
|
126
|
-
.rouge-highlight .s, .rouge-highlight .sb, .rouge-highlight .sd, .rouge-highlight .s2, .rouge-highlight .sh, .rouge-highlight .sx, .rouge-highlight .sr, .rouge-highlight .s1 {
|
|
129
|
+
.rouge-highlight .s, .rouge-highlight .sb, .rouge-highlight .dl, .rouge-highlight .sd, .rouge-highlight .s2, .rouge-highlight .sh, .rouge-highlight .sx, .rouge-highlight .sr, .rouge-highlight .s1 {
|
|
127
130
|
color: #fff0a6;
|
|
128
131
|
font-weight: bold;
|
|
129
132
|
}
|
|
133
|
+
.rouge-highlight .sa {
|
|
134
|
+
color: #FFF02A;
|
|
135
|
+
font-weight: bold;
|
|
136
|
+
}
|
|
130
137
|
.rouge-highlight .se {
|
|
131
138
|
color: #FAAF4C;
|
|
132
139
|
font-weight: bold;
|
|
@@ -149,7 +156,7 @@
|
|
|
149
156
|
.rouge-highlight .w {
|
|
150
157
|
color: #BBBBBB;
|
|
151
158
|
}
|
|
152
|
-
.rouge-highlight .nf {
|
|
159
|
+
.rouge-highlight .nf, .rouge-highlight .fm {
|
|
153
160
|
color: #41ff5b;
|
|
154
161
|
}
|
|
155
162
|
.rouge-highlight .py {
|
|
@@ -158,7 +165,7 @@
|
|
|
158
165
|
.rouge-highlight .na {
|
|
159
166
|
color: #41ff5b;
|
|
160
167
|
}
|
|
161
|
-
.rouge-highlight .nv, .rouge-highlight .vc, .rouge-highlight .vg, .rouge-highlight .vi {
|
|
168
|
+
.rouge-highlight .nv, .rouge-highlight .vc, .rouge-highlight .vg, .rouge-highlight .vi, .rouge-highlight .vm {
|
|
162
169
|
color: #41ff5b;
|
|
163
170
|
font-weight: bold;
|
|
164
171
|
}
|
|
@@ -6,20 +6,36 @@ module MarkdownViews
|
|
|
6
6
|
self.preprocessor = :erb
|
|
7
7
|
|
|
8
8
|
mattr_accessor :extensions
|
|
9
|
-
self.extensions =
|
|
9
|
+
self.extensions = Commonmarker::Config::OPTIONS[:extension].merge(
|
|
10
|
+
strikethrough: true,
|
|
11
|
+
tagfilter: true,
|
|
12
|
+
table: true,
|
|
13
|
+
autolink: true,
|
|
14
|
+
tasklist: false,
|
|
15
|
+
header_ids: nil,
|
|
16
|
+
shortcodes: false,
|
|
17
|
+
)
|
|
10
18
|
|
|
11
19
|
mattr_accessor :transformers
|
|
12
20
|
self.transformers = %i(code_blocks)
|
|
13
21
|
|
|
14
22
|
mattr_accessor :rendering_opts
|
|
15
|
-
self.rendering_opts =
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
self.rendering_opts = Commonmarker::Config::OPTIONS[:render].merge(
|
|
24
|
+
unsafe: true,
|
|
25
|
+
github_pre_lang: true,
|
|
26
|
+
hardbreaks: true,
|
|
27
|
+
escaped_char_spans: false,
|
|
28
|
+
)
|
|
18
29
|
|
|
19
30
|
mattr_accessor :parsing_opts
|
|
20
|
-
self.parsing_opts =
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
self.parsing_opts = Commonmarker::Config::OPTIONS[:parse].merge(
|
|
32
|
+
smart: true,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
mattr_accessor :plugins
|
|
36
|
+
self.plugins = Commonmarker::Config::PLUGINS.merge(
|
|
37
|
+
syntax_highlighter: nil,
|
|
38
|
+
)
|
|
23
39
|
|
|
24
40
|
mattr_accessor :rouge_opts
|
|
25
41
|
self.rouge_opts = {
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
module MarkdownViews
|
|
2
|
-
class Handler52
|
|
3
|
-
class << self
|
|
4
|
-
|
|
5
|
-
def call(template)
|
|
6
|
-
source = preprocessor.call(template)
|
|
7
|
-
|
|
8
|
-
<<-R1
|
|
9
|
-
MarkdownViews::Renderer.render(begin;#{source};end)
|
|
10
|
-
R1
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def preprocessor
|
|
14
|
-
@@preprocessor ||= begin
|
|
15
|
-
pp = MarkdownViews.preprocessor || :raw
|
|
16
|
-
ActionView::Template.registered_template_handler(pp) || raise('Unknown template handler')
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
2
|
class Handler
|
|
24
3
|
class << self
|
|
25
4
|
|
|
@@ -13,11 +13,26 @@ module MarkdownViews
|
|
|
13
13
|
# remainder all considered private
|
|
14
14
|
|
|
15
15
|
def render_md(input)
|
|
16
|
-
doc =
|
|
16
|
+
doc = Commonmarker.parse(input, options: {
|
|
17
|
+
extension: MarkdownViews.extensions,
|
|
18
|
+
parse: MarkdownViews.parsing_opts,
|
|
19
|
+
})
|
|
17
20
|
|
|
18
|
-
MarkdownViews.transformers.
|
|
21
|
+
if MarkdownViews.transformers.include? :code_blocks
|
|
22
|
+
code_blocks = transform_code_blocks(doc)
|
|
23
|
+
end
|
|
19
24
|
|
|
20
|
-
doc.to_html(
|
|
25
|
+
out = doc.to_html(
|
|
26
|
+
options: {
|
|
27
|
+
extension: MarkdownViews.extensions,
|
|
28
|
+
render: MarkdownViews.rendering_opts,
|
|
29
|
+
},
|
|
30
|
+
plugins: MarkdownViews.plugins
|
|
31
|
+
)
|
|
32
|
+
code_blocks&.each do |uuid, cb|
|
|
33
|
+
out.sub! uuid, cb
|
|
34
|
+
end
|
|
35
|
+
out
|
|
21
36
|
end
|
|
22
37
|
|
|
23
38
|
def rouge_formatter
|
|
@@ -52,6 +67,7 @@ module MarkdownViews
|
|
|
52
67
|
end
|
|
53
68
|
|
|
54
69
|
def transform_code_blocks(doc)
|
|
70
|
+
code_blocks = {}
|
|
55
71
|
doc.walk do |node|
|
|
56
72
|
next unless node.type == :code_block
|
|
57
73
|
next if node.fence_info == ''
|
|
@@ -64,11 +80,12 @@ module MarkdownViews
|
|
|
64
80
|
html = %Q{<pre lang="#{lang.gsub(/[^a-z0-9_-]/,'')}"><code class="rouge-highlight">#{html}</code></pre>}
|
|
65
81
|
end
|
|
66
82
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
node.
|
|
83
|
+
uuid = SecureRandom.uuid
|
|
84
|
+
code_blocks[uuid] = html
|
|
85
|
+
new_node = Commonmarker::Node.new(:text, content: "#{uuid}\n")
|
|
86
|
+
node.replace new_node
|
|
71
87
|
end
|
|
88
|
+
code_blocks
|
|
72
89
|
end
|
|
73
90
|
|
|
74
91
|
end
|
data/lib/markdown_views.rb
CHANGED
|
@@ -2,13 +2,10 @@ require 'action_view'
|
|
|
2
2
|
require 'commonmarker'
|
|
3
3
|
require 'rails'
|
|
4
4
|
require 'rouge'
|
|
5
|
+
require 'securerandom'
|
|
5
6
|
|
|
6
7
|
%w(config engine handler renderer version).each do |f|
|
|
7
8
|
require "markdown_views/#{f}"
|
|
8
9
|
end
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
ActionView::Template.register_template_handler(:md, MarkdownViews::Handler52)
|
|
12
|
-
else
|
|
13
|
-
ActionView::Template.register_template_handler(:md, MarkdownViews::Handler)
|
|
14
|
-
end
|
|
11
|
+
ActionView::Template.register_template_handler(:md, MarkdownViews::Handler)
|
data/markdown_views.gemspec
CHANGED
|
@@ -18,9 +18,12 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
-
spec.
|
|
22
|
-
|
|
23
|
-
spec.add_dependency '
|
|
21
|
+
spec.required_ruby_version = '~> 3.1'
|
|
22
|
+
|
|
23
|
+
spec.add_dependency 'commonmarker', '~> 1.1'
|
|
24
|
+
spec.add_dependency 'rails', '>= 6.1', '< 8.1'
|
|
25
|
+
spec.add_dependency 'rouge', '~> 4'
|
|
26
|
+
spec.add_dependency 'securerandom'
|
|
24
27
|
|
|
25
28
|
spec.add_development_dependency "minitest-reporters"
|
|
26
29
|
spec.add_development_dependency "rake"
|
data/test/config_test.rb
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class ConfigTest < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_extensions
|
|
6
|
+
processed = Commonmarker::Config.process_options(extension: MarkdownViews.extensions)[:extension]
|
|
7
|
+
expected = {
|
|
8
|
+
strikethrough: true,
|
|
9
|
+
tagfilter: true,
|
|
10
|
+
table: true,
|
|
11
|
+
autolink: true,
|
|
12
|
+
tasklist: false,
|
|
13
|
+
superscript: false,
|
|
14
|
+
# header_ids: '',
|
|
15
|
+
footnotes: false,
|
|
16
|
+
description_lists: false,
|
|
17
|
+
front_matter_delimiter: '',
|
|
18
|
+
multiline_block_quotes: false,
|
|
19
|
+
math_dollars: false,
|
|
20
|
+
math_code: false,
|
|
21
|
+
shortcodes: false,
|
|
22
|
+
wikilinks_title_before_pipe: false,
|
|
23
|
+
wikilinks_title_after_pipe: false,
|
|
24
|
+
underline: false,
|
|
25
|
+
spoiler: false,
|
|
26
|
+
greentext: false,
|
|
27
|
+
}
|
|
28
|
+
assert_equal expected, processed
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_parsing_opts
|
|
32
|
+
processed = Commonmarker::Config.process_options(parse: MarkdownViews.parsing_opts)[:parse]
|
|
33
|
+
expected = {
|
|
34
|
+
smart: true,
|
|
35
|
+
default_info_string: '',
|
|
36
|
+
relaxed_tasklist_matching: false,
|
|
37
|
+
relaxed_autolinks: false,
|
|
38
|
+
}
|
|
39
|
+
assert_equal expected, processed
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_plugins
|
|
43
|
+
processed = Commonmarker::Config.process_plugins(MarkdownViews.plugins)
|
|
44
|
+
expected = {
|
|
45
|
+
syntax_highlighter: nil
|
|
46
|
+
}
|
|
47
|
+
assert_equal expected, processed
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_rendering_opts
|
|
51
|
+
processed = Commonmarker::Config.process_options(render: MarkdownViews.rendering_opts)[:render]
|
|
52
|
+
expected = {
|
|
53
|
+
hardbreaks: true,
|
|
54
|
+
github_pre_lang: true,
|
|
55
|
+
full_info_string: false,
|
|
56
|
+
width: 80,
|
|
57
|
+
unsafe: true,
|
|
58
|
+
escape: false,
|
|
59
|
+
sourcepos: false,
|
|
60
|
+
escaped_char_spans: false,
|
|
61
|
+
ignore_setext: false,
|
|
62
|
+
ignore_empty_links: false,
|
|
63
|
+
gfm_quirks: false,
|
|
64
|
+
prefer_fenced: false,
|
|
65
|
+
}
|
|
66
|
+
assert_equal expected, processed
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
data/test/render_test.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require "test_helper"
|
|
2
|
+
|
|
3
|
+
class RenderTest < Minitest::Test
|
|
4
|
+
|
|
5
|
+
def test_markdown
|
|
6
|
+
s = <<~MD
|
|
7
|
+
# header
|
|
8
|
+
this is *amazing*!
|
|
9
|
+
MD
|
|
10
|
+
o = <<~HTML
|
|
11
|
+
<h1>header</h1>
|
|
12
|
+
<p>this is <em>amazing</em>!</p>
|
|
13
|
+
HTML
|
|
14
|
+
assert_equal o, render(s)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_inline_html
|
|
18
|
+
s = <<~MD
|
|
19
|
+
---
|
|
20
|
+
<em>inline</em> html
|
|
21
|
+
MD
|
|
22
|
+
o = <<~HTML
|
|
23
|
+
<hr />
|
|
24
|
+
<p><em>inline</em> html</p>
|
|
25
|
+
HTML
|
|
26
|
+
assert_equal o, render(s)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_code_block
|
|
30
|
+
s = <<~MD
|
|
31
|
+
```ruby
|
|
32
|
+
def syntax_highlighting
|
|
33
|
+
'works too!'
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
MD
|
|
37
|
+
o = <<~HTML
|
|
38
|
+
<pre lang=\"ruby\"><code class=\"rouge-highlight\"><span class=\"k\">def</span> <span class=\"nf\">syntax_highlighting</span>
|
|
39
|
+
<span class=\"s1\">'works too!'</span>
|
|
40
|
+
<span class=\"k\">end</span></code></pre>
|
|
41
|
+
HTML
|
|
42
|
+
assert_equal o, render(s)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def render(*args)
|
|
47
|
+
MarkdownViews::Renderer.render(*args)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
data/test/strip_comments_test.rb
CHANGED
|
@@ -53,10 +53,4 @@ class StripCommentsTest < Minitest::Test
|
|
|
53
53
|
MarkdownViews::Renderer.strip_comments(*args)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
# hack to make diffs more understandable
|
|
57
|
-
# otherwise minitest sometimes truncates multi-lines diffs, making them unusable
|
|
58
|
-
def mu_pp(obj)
|
|
59
|
-
super obj.gsub("\n", '\n').gsub("\t", '\t')
|
|
60
|
-
end
|
|
61
|
-
|
|
62
56
|
end
|
data/test/test_helper.rb
CHANGED
|
@@ -5,3 +5,19 @@ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
|
|
5
5
|
require "markdown_views"
|
|
6
6
|
|
|
7
7
|
require "minitest/autorun"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
module TestHelpers
|
|
11
|
+
|
|
12
|
+
# hack to make diffs more understandable
|
|
13
|
+
# otherwise minitest sometimes truncates multi-lines diffs, making them unusable
|
|
14
|
+
def mu_pp(obj)
|
|
15
|
+
if obj.is_a? String
|
|
16
|
+
super obj.gsub("\n", '\n').gsub("\t", '\t')
|
|
17
|
+
else
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
Minitest::Test.include TestHelpers
|
metadata
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: markdown_views
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thomas morgan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: commonmarker
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.18.2
|
|
20
|
-
- - "<"
|
|
17
|
+
- - "~>"
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
19
|
+
version: '1.1'
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
|
-
- - "
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.18.2
|
|
30
|
-
- - "<"
|
|
24
|
+
- - "~>"
|
|
31
25
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
26
|
+
version: '1.1'
|
|
33
27
|
- !ruby/object:Gem::Dependency
|
|
34
28
|
name: rails
|
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
|
36
30
|
requirements:
|
|
37
31
|
- - ">="
|
|
38
32
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
33
|
+
version: '6.1'
|
|
40
34
|
- - "<"
|
|
41
35
|
- !ruby/object:Gem::Version
|
|
42
36
|
version: '8.1'
|
|
@@ -46,7 +40,7 @@ dependencies:
|
|
|
46
40
|
requirements:
|
|
47
41
|
- - ">="
|
|
48
42
|
- !ruby/object:Gem::Version
|
|
49
|
-
version: '
|
|
43
|
+
version: '6.1'
|
|
50
44
|
- - "<"
|
|
51
45
|
- !ruby/object:Gem::Version
|
|
52
46
|
version: '8.1'
|
|
@@ -54,22 +48,30 @@ dependencies:
|
|
|
54
48
|
name: rouge
|
|
55
49
|
requirement: !ruby/object:Gem::Requirement
|
|
56
50
|
requirements:
|
|
57
|
-
- - "
|
|
58
|
-
- !ruby/object:Gem::Version
|
|
59
|
-
version: '3.3'
|
|
60
|
-
- - "<"
|
|
51
|
+
- - "~>"
|
|
61
52
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
53
|
+
version: '4'
|
|
63
54
|
type: :runtime
|
|
64
55
|
prerelease: false
|
|
65
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '4'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: securerandom
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
66
64
|
requirements:
|
|
67
65
|
- - ">="
|
|
68
66
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
70
|
-
|
|
67
|
+
version: '0'
|
|
68
|
+
type: :runtime
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
71
73
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '
|
|
74
|
+
version: '0'
|
|
73
75
|
- !ruby/object:Gem::Dependency
|
|
74
76
|
name: minitest-reporters
|
|
75
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -118,8 +120,10 @@ files:
|
|
|
118
120
|
- app/assets/stylesheets/rouge.base16.monokai.light.css
|
|
119
121
|
- app/assets/stylesheets/rouge.base16.solarized.dark.css
|
|
120
122
|
- app/assets/stylesheets/rouge.base16.solarized.light.css
|
|
123
|
+
- app/assets/stylesheets/rouge.bw.css
|
|
121
124
|
- app/assets/stylesheets/rouge.colorful.css
|
|
122
|
-
- app/assets/stylesheets/rouge.github.css
|
|
125
|
+
- app/assets/stylesheets/rouge.github.dark.css
|
|
126
|
+
- app/assets/stylesheets/rouge.github.light.css
|
|
123
127
|
- app/assets/stylesheets/rouge.gruvbox.dark.css
|
|
124
128
|
- app/assets/stylesheets/rouge.gruvbox.light.css
|
|
125
129
|
- app/assets/stylesheets/rouge.igorpro.css
|
|
@@ -137,6 +141,8 @@ files:
|
|
|
137
141
|
- lib/markdown_views/renderer.rb
|
|
138
142
|
- lib/markdown_views/version.rb
|
|
139
143
|
- markdown_views.gemspec
|
|
144
|
+
- test/config_test.rb
|
|
145
|
+
- test/render_test.rb
|
|
140
146
|
- test/strip_comments_test.rb
|
|
141
147
|
- test/test_helper.rb
|
|
142
148
|
homepage: https://github.com/zarqman/markdown_views
|
|
@@ -149,9 +155,9 @@ require_paths:
|
|
|
149
155
|
- lib
|
|
150
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
157
|
requirements:
|
|
152
|
-
- - "
|
|
158
|
+
- - "~>"
|
|
153
159
|
- !ruby/object:Gem::Version
|
|
154
|
-
version: '
|
|
160
|
+
version: '3.1'
|
|
155
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
162
|
requirements:
|
|
157
163
|
- - ">="
|
|
@@ -163,5 +169,7 @@ signing_key:
|
|
|
163
169
|
specification_version: 4
|
|
164
170
|
summary: Add .md template handler to Rails.
|
|
165
171
|
test_files:
|
|
172
|
+
- test/config_test.rb
|
|
173
|
+
- test/render_test.rb
|
|
166
174
|
- test/strip_comments_test.rb
|
|
167
175
|
- test/test_helper.rb
|