markdown_views 3.3.0 → 3.5.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/README.md +21 -11
- data/Rakefile +5 -2
- data/app/assets/stylesheets/rouge.magritte.css +175 -0
- data/lib/markdown_views/handler.rb +13 -4
- data/lib/markdown_views/version.rb +1 -1
- metadata +16 -18
- data/.gitignore +0 -17
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -234
- data/markdown_views.gemspec +0 -30
- data/test/config_test.rb +0 -86
- data/test/render_test.rb +0 -75
- data/test/strip_comments_test.rb +0 -56
- data/test/test_helper.rb +0 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 91b84a7ec0592a3a41061db057e8abfe3f549b39c5e5dc0a52af6a2559f14465
|
|
4
|
+
data.tar.gz: 481980a8af3e86703ba67ebcf89e6993c3067e76771e99385e514a4f02d55f99
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c57762ed95990edfe704c926687cae2c00c56194f8c484481fdeb631e88a254d02f21a96be82d786e968e9864b442c8b49b4f9d33c91c4620c36de36aa1a020
|
|
7
|
+
data.tar.gz: 0e80e781992c434a15879eaf47f1ff99784e3214ee88587d358d2bbf3766728dc3dcedc4746c36114dcbb80600564e78cdd09be8e5e73c3d2a11efbea57d4011
|
data/README.md
CHANGED
|
@@ -70,14 +70,10 @@ See `app/assets/stylesheets/` for the complete list.
|
|
|
70
70
|
|
|
71
71
|
## Installation
|
|
72
72
|
|
|
73
|
-
Add
|
|
73
|
+
Add to Gemfile:
|
|
74
74
|
|
|
75
75
|
gem 'markdown_views'
|
|
76
76
|
|
|
77
|
-
And then execute:
|
|
78
|
-
|
|
79
|
-
$ bundle
|
|
80
|
-
|
|
81
77
|
|
|
82
78
|
## Gem versions
|
|
83
79
|
|
|
@@ -95,13 +91,27 @@ The stylesheets were refreshed from Rouge 4.4 which corrects a few missing CSS s
|
|
|
95
91
|
|
|
96
92
|
## Contributing
|
|
97
93
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
Contributions are welcomed. If unsure about the scope or reach of a potential PR, feel free to open a discussion Issue first (not required though).
|
|
95
|
+
|
|
96
|
+
Please submit human-written contributions only. No contributions containing output generated by LLMs or other non-deterministic systems are allowed.
|
|
97
|
+
|
|
98
|
+
* Code, tests, docs, PRs: must be 100% human written.
|
|
99
|
+
* Issues, security reports: must originally be 100% human written. If not originally in English, an LLM may be used to translate to English provided that this translation is disclosed.
|
|
100
|
+
|
|
101
|
+
We recognize that opinions about the use of LLMs and non-deterministic systems vary widely. Still, we respectfully ask that you honor this policy when interacting with this project.
|
|
102
|
+
|
|
103
|
+
###### Q: May I use LLMs apart from contributions?
|
|
104
|
+
All usage, training or otherwise, must respect copyrights. Beyond that, we've found that LLMs are prone to errors and misunderstandings--sometimes obvious, sometimes subtle. Please verify everything before trusting an LLM's output.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
#### Running tests
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
bundle install
|
|
111
|
+
rake [test]
|
|
112
|
+
```
|
|
103
113
|
|
|
104
114
|
|
|
105
115
|
## License
|
|
106
116
|
|
|
107
|
-
MIT
|
|
117
|
+
[MIT](LICENSE.txt)
|
data/Rakefile
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
|
2
|
+
load "rails/tasks/engine.rake"
|
|
3
|
+
|
|
1
4
|
require "bundler/gem_tasks"
|
|
2
5
|
require "rake/testtask"
|
|
3
6
|
|
|
7
|
+
desc 'regenerate stylesheets for rouge themes'
|
|
4
8
|
task :generate_stylesheets do
|
|
5
9
|
%w( base16.dark base16.light base16.monokai.dark base16.monokai.light
|
|
6
10
|
base16.solarized.dark base16.solarized.light bw colorful
|
|
7
|
-
github.dark github.light gruvbox.dark gruvbox.light igorpro molokai
|
|
11
|
+
github.dark github.light gruvbox.dark gruvbox.light igorpro magritte molokai
|
|
8
12
|
monokai monokai.sublime pastie thankful_eyes tulip
|
|
9
13
|
).each do |theme|
|
|
10
14
|
`rougify style #{theme} --scope .rouge-highlight > app/assets/stylesheets/rouge.#{theme}.css`
|
|
@@ -16,7 +20,6 @@ Rake::TestTask.new(:test) do |t|
|
|
|
16
20
|
t.libs << "test"
|
|
17
21
|
t.libs << "lib"
|
|
18
22
|
t.test_files = FileList["test/**/*_test.rb"]
|
|
19
|
-
t.warning = false # rouge is very noisy
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
task :default => :test
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
.rouge-highlight table td { padding: 5px; }
|
|
2
|
+
.rouge-highlight table pre { margin: 0; }
|
|
3
|
+
.rouge-highlight {
|
|
4
|
+
color: #000707;
|
|
5
|
+
background-color: #f3ffff;
|
|
6
|
+
}
|
|
7
|
+
.rouge-highlight .gl {
|
|
8
|
+
color: #f3ffff;
|
|
9
|
+
background-color: #000707;
|
|
10
|
+
}
|
|
11
|
+
.rouge-highlight .c, .rouge-highlight .ch, .rouge-highlight .cd, .rouge-highlight .cm, .rouge-highlight .cpf, .rouge-highlight .c1, .rouge-highlight .cs {
|
|
12
|
+
color: #006c6c;
|
|
13
|
+
font-style: italic;
|
|
14
|
+
}
|
|
15
|
+
.rouge-highlight .cp {
|
|
16
|
+
color: #920241;
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
}
|
|
19
|
+
.rouge-highlight .err {
|
|
20
|
+
color: #f3ffff;
|
|
21
|
+
background-color: #f22700;
|
|
22
|
+
}
|
|
23
|
+
.rouge-highlight .gr {
|
|
24
|
+
color: #f22700;
|
|
25
|
+
font-weight: bold;
|
|
26
|
+
font-style: italic;
|
|
27
|
+
}
|
|
28
|
+
.rouge-highlight .k, .rouge-highlight .kd, .rouge-highlight .kv {
|
|
29
|
+
color: #19003a;
|
|
30
|
+
font-weight: bold;
|
|
31
|
+
}
|
|
32
|
+
.rouge-highlight .o, .rouge-highlight .ow {
|
|
33
|
+
color: #4c48fe;
|
|
34
|
+
font-weight: bold;
|
|
35
|
+
}
|
|
36
|
+
.rouge-highlight .p, .rouge-highlight .pi {
|
|
37
|
+
color: #4c48fe;
|
|
38
|
+
}
|
|
39
|
+
.rouge-highlight .gd {
|
|
40
|
+
color: #f22700;
|
|
41
|
+
}
|
|
42
|
+
.rouge-highlight .gi {
|
|
43
|
+
color: #007500;
|
|
44
|
+
}
|
|
45
|
+
.rouge-highlight .ge {
|
|
46
|
+
font-style: italic;
|
|
47
|
+
}
|
|
48
|
+
.rouge-highlight .ges {
|
|
49
|
+
font-weight: bold;
|
|
50
|
+
font-style: italic;
|
|
51
|
+
}
|
|
52
|
+
.rouge-highlight .gs {
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
}
|
|
55
|
+
.rouge-highlight .gt {
|
|
56
|
+
color: #000000;
|
|
57
|
+
background-color: #d8d9ff;
|
|
58
|
+
}
|
|
59
|
+
.rouge-highlight .kc {
|
|
60
|
+
color: #007500;
|
|
61
|
+
font-weight: bold;
|
|
62
|
+
}
|
|
63
|
+
.rouge-highlight .kn {
|
|
64
|
+
color: #007500;
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
}
|
|
67
|
+
.rouge-highlight .kp {
|
|
68
|
+
color: #007500;
|
|
69
|
+
font-weight: bold;
|
|
70
|
+
}
|
|
71
|
+
.rouge-highlight .kr {
|
|
72
|
+
color: #007500;
|
|
73
|
+
font-weight: bold;
|
|
74
|
+
}
|
|
75
|
+
.rouge-highlight .gh {
|
|
76
|
+
color: #007500;
|
|
77
|
+
font-weight: bold;
|
|
78
|
+
}
|
|
79
|
+
.rouge-highlight .gu {
|
|
80
|
+
color: #007500;
|
|
81
|
+
font-weight: bold;
|
|
82
|
+
}
|
|
83
|
+
.rouge-highlight .kt {
|
|
84
|
+
color: #920241;
|
|
85
|
+
font-weight: bold;
|
|
86
|
+
}
|
|
87
|
+
.rouge-highlight .no {
|
|
88
|
+
color: #920241;
|
|
89
|
+
font-weight: bold;
|
|
90
|
+
}
|
|
91
|
+
.rouge-highlight .nc {
|
|
92
|
+
color: #920241;
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
}
|
|
95
|
+
.rouge-highlight .nd {
|
|
96
|
+
color: #920241;
|
|
97
|
+
font-weight: bold;
|
|
98
|
+
}
|
|
99
|
+
.rouge-highlight .nn {
|
|
100
|
+
color: #920241;
|
|
101
|
+
font-weight: bold;
|
|
102
|
+
}
|
|
103
|
+
.rouge-highlight .bp {
|
|
104
|
+
color: #920241;
|
|
105
|
+
font-weight: bold;
|
|
106
|
+
}
|
|
107
|
+
.rouge-highlight .ne {
|
|
108
|
+
color: #920241;
|
|
109
|
+
font-weight: bold;
|
|
110
|
+
}
|
|
111
|
+
.rouge-highlight .nl {
|
|
112
|
+
color: #840084;
|
|
113
|
+
font-weight: bold;
|
|
114
|
+
}
|
|
115
|
+
.rouge-highlight .nt {
|
|
116
|
+
color: #840084;
|
|
117
|
+
font-weight: bold;
|
|
118
|
+
}
|
|
119
|
+
.rouge-highlight .m, .rouge-highlight .mb, .rouge-highlight .mf, .rouge-highlight .mh, .rouge-highlight .mi, .rouge-highlight .il, .rouge-highlight .mo, .rouge-highlight .mx {
|
|
120
|
+
color: #007500;
|
|
121
|
+
font-weight: bold;
|
|
122
|
+
}
|
|
123
|
+
.rouge-highlight .ld {
|
|
124
|
+
color: #007500;
|
|
125
|
+
font-weight: bold;
|
|
126
|
+
}
|
|
127
|
+
.rouge-highlight .ss {
|
|
128
|
+
color: #007500;
|
|
129
|
+
}
|
|
130
|
+
.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 {
|
|
131
|
+
color: #7c0000;
|
|
132
|
+
font-weight: bold;
|
|
133
|
+
}
|
|
134
|
+
.rouge-highlight .sa {
|
|
135
|
+
color: #19003a;
|
|
136
|
+
font-weight: bold;
|
|
137
|
+
}
|
|
138
|
+
.rouge-highlight .se {
|
|
139
|
+
color: #840084;
|
|
140
|
+
font-weight: bold;
|
|
141
|
+
}
|
|
142
|
+
.rouge-highlight .sc {
|
|
143
|
+
color: #840084;
|
|
144
|
+
font-weight: bold;
|
|
145
|
+
}
|
|
146
|
+
.rouge-highlight .si {
|
|
147
|
+
color: #840084;
|
|
148
|
+
font-weight: bold;
|
|
149
|
+
}
|
|
150
|
+
.rouge-highlight .nb {
|
|
151
|
+
font-weight: bold;
|
|
152
|
+
}
|
|
153
|
+
.rouge-highlight .ni {
|
|
154
|
+
color: #999999;
|
|
155
|
+
font-weight: bold;
|
|
156
|
+
}
|
|
157
|
+
.rouge-highlight .w {
|
|
158
|
+
color: #BBBBBB;
|
|
159
|
+
}
|
|
160
|
+
.rouge-highlight .go {
|
|
161
|
+
color: #19003a;
|
|
162
|
+
}
|
|
163
|
+
.rouge-highlight .nf, .rouge-highlight .fm {
|
|
164
|
+
color: #ff0089;
|
|
165
|
+
}
|
|
166
|
+
.rouge-highlight .py {
|
|
167
|
+
color: #ff0089;
|
|
168
|
+
}
|
|
169
|
+
.rouge-highlight .na {
|
|
170
|
+
color: #ff0089;
|
|
171
|
+
}
|
|
172
|
+
.rouge-highlight .nv, .rouge-highlight .vc, .rouge-highlight .vg, .rouge-highlight .vi, .rouge-highlight .vm {
|
|
173
|
+
color: #ff0089;
|
|
174
|
+
font-weight: bold;
|
|
175
|
+
}
|
|
@@ -10,10 +10,19 @@ module MarkdownViews
|
|
|
10
10
|
R1
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
if ActionView::Template::Handlers.respond_to?(:template_handlers) # as of rails 8.2
|
|
14
|
+
def preprocessor
|
|
15
|
+
@@preprocessor ||= begin
|
|
16
|
+
pp = MarkdownViews.preprocessor || :raw
|
|
17
|
+
ActionView::Template::Handlers.template_handlers[pp.to_sym] || raise('Unknown template handler')
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
else
|
|
21
|
+
def preprocessor
|
|
22
|
+
@@preprocessor ||= begin
|
|
23
|
+
pp = MarkdownViews.preprocessor || :raw
|
|
24
|
+
ActionView::Template.registered_template_handler(pp) || raise('Unknown template handler')
|
|
25
|
+
end
|
|
17
26
|
end
|
|
18
27
|
end
|
|
19
28
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: markdown_views
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thomas morgan
|
|
@@ -47,16 +47,22 @@ dependencies:
|
|
|
47
47
|
name: rouge
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
49
49
|
requirements:
|
|
50
|
-
- - "
|
|
50
|
+
- - ">="
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
52
|
version: '4'
|
|
53
|
+
- - "<"
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '6'
|
|
53
56
|
type: :runtime
|
|
54
57
|
prerelease: false
|
|
55
58
|
version_requirements: !ruby/object:Gem::Requirement
|
|
56
59
|
requirements:
|
|
57
|
-
- - "
|
|
60
|
+
- - ">="
|
|
58
61
|
- !ruby/object:Gem::Version
|
|
59
62
|
version: '4'
|
|
63
|
+
- - "<"
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '6'
|
|
60
66
|
- !ruby/object:Gem::Dependency
|
|
61
67
|
name: securerandom
|
|
62
68
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -107,9 +113,6 @@ executables: []
|
|
|
107
113
|
extensions: []
|
|
108
114
|
extra_rdoc_files: []
|
|
109
115
|
files:
|
|
110
|
-
- ".gitignore"
|
|
111
|
-
- Gemfile
|
|
112
|
-
- Gemfile.lock
|
|
113
116
|
- LICENSE.txt
|
|
114
117
|
- README.md
|
|
115
118
|
- Rakefile
|
|
@@ -126,6 +129,7 @@ files:
|
|
|
126
129
|
- app/assets/stylesheets/rouge.gruvbox.dark.css
|
|
127
130
|
- app/assets/stylesheets/rouge.gruvbox.light.css
|
|
128
131
|
- app/assets/stylesheets/rouge.igorpro.css
|
|
132
|
+
- app/assets/stylesheets/rouge.magritte.css
|
|
129
133
|
- app/assets/stylesheets/rouge.molokai.css
|
|
130
134
|
- app/assets/stylesheets/rouge.monokai.css
|
|
131
135
|
- app/assets/stylesheets/rouge.monokai.sublime.css
|
|
@@ -139,15 +143,13 @@ files:
|
|
|
139
143
|
- lib/markdown_views/handler.rb
|
|
140
144
|
- lib/markdown_views/renderer.rb
|
|
141
145
|
- lib/markdown_views/version.rb
|
|
142
|
-
- markdown_views.gemspec
|
|
143
|
-
- test/config_test.rb
|
|
144
|
-
- test/render_test.rb
|
|
145
|
-
- test/strip_comments_test.rb
|
|
146
|
-
- test/test_helper.rb
|
|
147
146
|
homepage: https://github.com/zarqman/markdown_views
|
|
148
147
|
licenses:
|
|
149
148
|
- MIT
|
|
150
|
-
metadata:
|
|
149
|
+
metadata:
|
|
150
|
+
homepage_uri: https://github.com/zarqman/markdown_views
|
|
151
|
+
source_code_uri: https://github.com/zarqman/markdown_views
|
|
152
|
+
changelog_uri: https://github.com/zarqman/markdown_views/blob/master/CHANGELOG.md
|
|
151
153
|
rdoc_options: []
|
|
152
154
|
require_paths:
|
|
153
155
|
- lib
|
|
@@ -162,11 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
162
164
|
- !ruby/object:Gem::Version
|
|
163
165
|
version: '0'
|
|
164
166
|
requirements: []
|
|
165
|
-
rubygems_version:
|
|
167
|
+
rubygems_version: 4.0.16
|
|
166
168
|
specification_version: 4
|
|
167
169
|
summary: Add .md template handler to Rails.
|
|
168
|
-
test_files:
|
|
169
|
-
- test/config_test.rb
|
|
170
|
-
- test/render_test.rb
|
|
171
|
-
- test/strip_comments_test.rb
|
|
172
|
-
- test/test_helper.rb
|
|
170
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
markdown_views (3.3.0)
|
|
5
|
-
commonmarker (>= 1.1, < 3.0)
|
|
6
|
-
rails (>= 6.1)
|
|
7
|
-
rouge (~> 4)
|
|
8
|
-
securerandom
|
|
9
|
-
|
|
10
|
-
GEM
|
|
11
|
-
remote: https://rubygems.org/
|
|
12
|
-
specs:
|
|
13
|
-
action_text-trix (2.1.18)
|
|
14
|
-
railties
|
|
15
|
-
actioncable (8.1.3)
|
|
16
|
-
actionpack (= 8.1.3)
|
|
17
|
-
activesupport (= 8.1.3)
|
|
18
|
-
nio4r (~> 2.0)
|
|
19
|
-
websocket-driver (>= 0.6.1)
|
|
20
|
-
zeitwerk (~> 2.6)
|
|
21
|
-
actionmailbox (8.1.3)
|
|
22
|
-
actionpack (= 8.1.3)
|
|
23
|
-
activejob (= 8.1.3)
|
|
24
|
-
activerecord (= 8.1.3)
|
|
25
|
-
activestorage (= 8.1.3)
|
|
26
|
-
activesupport (= 8.1.3)
|
|
27
|
-
mail (>= 2.8.0)
|
|
28
|
-
actionmailer (8.1.3)
|
|
29
|
-
actionpack (= 8.1.3)
|
|
30
|
-
actionview (= 8.1.3)
|
|
31
|
-
activejob (= 8.1.3)
|
|
32
|
-
activesupport (= 8.1.3)
|
|
33
|
-
mail (>= 2.8.0)
|
|
34
|
-
rails-dom-testing (~> 2.2)
|
|
35
|
-
actionpack (8.1.3)
|
|
36
|
-
actionview (= 8.1.3)
|
|
37
|
-
activesupport (= 8.1.3)
|
|
38
|
-
nokogiri (>= 1.8.5)
|
|
39
|
-
rack (>= 2.2.4)
|
|
40
|
-
rack-session (>= 1.0.1)
|
|
41
|
-
rack-test (>= 0.6.3)
|
|
42
|
-
rails-dom-testing (~> 2.2)
|
|
43
|
-
rails-html-sanitizer (~> 1.6)
|
|
44
|
-
useragent (~> 0.16)
|
|
45
|
-
actiontext (8.1.3)
|
|
46
|
-
action_text-trix (~> 2.1.15)
|
|
47
|
-
actionpack (= 8.1.3)
|
|
48
|
-
activerecord (= 8.1.3)
|
|
49
|
-
activestorage (= 8.1.3)
|
|
50
|
-
activesupport (= 8.1.3)
|
|
51
|
-
globalid (>= 0.6.0)
|
|
52
|
-
nokogiri (>= 1.8.5)
|
|
53
|
-
actionview (8.1.3)
|
|
54
|
-
activesupport (= 8.1.3)
|
|
55
|
-
builder (~> 3.1)
|
|
56
|
-
erubi (~> 1.11)
|
|
57
|
-
rails-dom-testing (~> 2.2)
|
|
58
|
-
rails-html-sanitizer (~> 1.6)
|
|
59
|
-
activejob (8.1.3)
|
|
60
|
-
activesupport (= 8.1.3)
|
|
61
|
-
globalid (>= 0.3.6)
|
|
62
|
-
activemodel (8.1.3)
|
|
63
|
-
activesupport (= 8.1.3)
|
|
64
|
-
activerecord (8.1.3)
|
|
65
|
-
activemodel (= 8.1.3)
|
|
66
|
-
activesupport (= 8.1.3)
|
|
67
|
-
timeout (>= 0.4.0)
|
|
68
|
-
activestorage (8.1.3)
|
|
69
|
-
actionpack (= 8.1.3)
|
|
70
|
-
activejob (= 8.1.3)
|
|
71
|
-
activerecord (= 8.1.3)
|
|
72
|
-
activesupport (= 8.1.3)
|
|
73
|
-
marcel (~> 1.0)
|
|
74
|
-
activesupport (8.1.3)
|
|
75
|
-
base64
|
|
76
|
-
bigdecimal
|
|
77
|
-
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
78
|
-
connection_pool (>= 2.2.5)
|
|
79
|
-
drb
|
|
80
|
-
i18n (>= 1.6, < 2)
|
|
81
|
-
json
|
|
82
|
-
logger (>= 1.4.2)
|
|
83
|
-
minitest (>= 5.1)
|
|
84
|
-
securerandom (>= 0.3)
|
|
85
|
-
tzinfo (~> 2.0, >= 2.0.5)
|
|
86
|
-
uri (>= 0.13.1)
|
|
87
|
-
ansi (1.6.0)
|
|
88
|
-
base64 (0.3.0)
|
|
89
|
-
bigdecimal (4.1.2)
|
|
90
|
-
builder (3.3.0)
|
|
91
|
-
commonmarker (2.8.1-aarch64-linux)
|
|
92
|
-
commonmarker (2.8.1-arm64-darwin)
|
|
93
|
-
commonmarker (2.8.1-x86_64-darwin)
|
|
94
|
-
commonmarker (2.8.1-x86_64-linux)
|
|
95
|
-
concurrent-ruby (1.3.6)
|
|
96
|
-
connection_pool (3.0.2)
|
|
97
|
-
crass (1.0.6)
|
|
98
|
-
date (3.5.1)
|
|
99
|
-
drb (2.2.3)
|
|
100
|
-
erb (6.0.4)
|
|
101
|
-
erubi (1.13.1)
|
|
102
|
-
globalid (1.3.0)
|
|
103
|
-
activesupport (>= 6.1)
|
|
104
|
-
i18n (1.14.8)
|
|
105
|
-
concurrent-ruby (~> 1.0)
|
|
106
|
-
io-console (0.8.2)
|
|
107
|
-
irb (1.18.0)
|
|
108
|
-
pp (>= 0.6.0)
|
|
109
|
-
prism (>= 1.3.0)
|
|
110
|
-
rdoc (>= 4.0.0)
|
|
111
|
-
reline (>= 0.4.2)
|
|
112
|
-
json (2.19.4)
|
|
113
|
-
logger (1.7.0)
|
|
114
|
-
loofah (2.25.1)
|
|
115
|
-
crass (~> 1.0.2)
|
|
116
|
-
nokogiri (>= 1.12.0)
|
|
117
|
-
mail (2.9.0)
|
|
118
|
-
logger
|
|
119
|
-
mini_mime (>= 0.1.1)
|
|
120
|
-
net-imap
|
|
121
|
-
net-pop
|
|
122
|
-
net-smtp
|
|
123
|
-
marcel (1.1.0)
|
|
124
|
-
mini_mime (1.1.5)
|
|
125
|
-
minitest (6.0.6)
|
|
126
|
-
drb (~> 2.0)
|
|
127
|
-
prism (~> 1.5)
|
|
128
|
-
minitest-reporters (1.8.0)
|
|
129
|
-
ansi
|
|
130
|
-
builder
|
|
131
|
-
minitest (>= 5.0, < 7)
|
|
132
|
-
ruby-progressbar
|
|
133
|
-
net-imap (0.6.4)
|
|
134
|
-
date
|
|
135
|
-
net-protocol
|
|
136
|
-
net-pop (0.1.2)
|
|
137
|
-
net-protocol
|
|
138
|
-
net-protocol (0.2.2)
|
|
139
|
-
timeout
|
|
140
|
-
net-smtp (0.5.1)
|
|
141
|
-
net-protocol
|
|
142
|
-
nio4r (2.7.5)
|
|
143
|
-
nokogiri (1.19.3-aarch64-linux-gnu)
|
|
144
|
-
racc (~> 1.4)
|
|
145
|
-
nokogiri (1.19.3-arm64-darwin)
|
|
146
|
-
racc (~> 1.4)
|
|
147
|
-
nokogiri (1.19.3-x86_64-darwin)
|
|
148
|
-
racc (~> 1.4)
|
|
149
|
-
nokogiri (1.19.3-x86_64-linux-gnu)
|
|
150
|
-
racc (~> 1.4)
|
|
151
|
-
pp (0.6.3)
|
|
152
|
-
prettyprint
|
|
153
|
-
prettyprint (0.2.0)
|
|
154
|
-
prism (1.9.0)
|
|
155
|
-
psych (5.3.1)
|
|
156
|
-
date
|
|
157
|
-
stringio
|
|
158
|
-
racc (1.8.1)
|
|
159
|
-
rack (3.2.6)
|
|
160
|
-
rack-session (2.1.2)
|
|
161
|
-
base64 (>= 0.1.0)
|
|
162
|
-
rack (>= 3.0.0)
|
|
163
|
-
rack-test (2.2.0)
|
|
164
|
-
rack (>= 1.3)
|
|
165
|
-
rackup (2.3.1)
|
|
166
|
-
rack (>= 3)
|
|
167
|
-
rails (8.1.3)
|
|
168
|
-
actioncable (= 8.1.3)
|
|
169
|
-
actionmailbox (= 8.1.3)
|
|
170
|
-
actionmailer (= 8.1.3)
|
|
171
|
-
actionpack (= 8.1.3)
|
|
172
|
-
actiontext (= 8.1.3)
|
|
173
|
-
actionview (= 8.1.3)
|
|
174
|
-
activejob (= 8.1.3)
|
|
175
|
-
activemodel (= 8.1.3)
|
|
176
|
-
activerecord (= 8.1.3)
|
|
177
|
-
activestorage (= 8.1.3)
|
|
178
|
-
activesupport (= 8.1.3)
|
|
179
|
-
bundler (>= 1.15.0)
|
|
180
|
-
railties (= 8.1.3)
|
|
181
|
-
rails-dom-testing (2.3.0)
|
|
182
|
-
activesupport (>= 5.0.0)
|
|
183
|
-
minitest
|
|
184
|
-
nokogiri (>= 1.6)
|
|
185
|
-
rails-html-sanitizer (1.7.0)
|
|
186
|
-
loofah (~> 2.25)
|
|
187
|
-
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
188
|
-
railties (8.1.3)
|
|
189
|
-
actionpack (= 8.1.3)
|
|
190
|
-
activesupport (= 8.1.3)
|
|
191
|
-
irb (~> 1.13)
|
|
192
|
-
rackup (>= 1.0.0)
|
|
193
|
-
rake (>= 12.2)
|
|
194
|
-
thor (~> 1.0, >= 1.2.2)
|
|
195
|
-
tsort (>= 0.2)
|
|
196
|
-
zeitwerk (~> 2.6)
|
|
197
|
-
rake (13.4.2)
|
|
198
|
-
rdoc (7.2.0)
|
|
199
|
-
erb
|
|
200
|
-
psych (>= 4.0.0)
|
|
201
|
-
tsort
|
|
202
|
-
reline (0.6.3)
|
|
203
|
-
io-console (~> 0.5)
|
|
204
|
-
rouge (4.7.0)
|
|
205
|
-
ruby-progressbar (1.13.0)
|
|
206
|
-
securerandom (0.4.1)
|
|
207
|
-
stringio (3.2.0)
|
|
208
|
-
thor (1.5.0)
|
|
209
|
-
timeout (0.6.1)
|
|
210
|
-
tsort (0.2.0)
|
|
211
|
-
tzinfo (2.0.6)
|
|
212
|
-
concurrent-ruby (~> 1.0)
|
|
213
|
-
uri (1.1.1)
|
|
214
|
-
useragent (0.16.11)
|
|
215
|
-
websocket-driver (0.8.0)
|
|
216
|
-
base64
|
|
217
|
-
websocket-extensions (>= 0.1.0)
|
|
218
|
-
websocket-extensions (0.1.5)
|
|
219
|
-
zeitwerk (2.7.5)
|
|
220
|
-
|
|
221
|
-
PLATFORMS
|
|
222
|
-
aarch64-linux
|
|
223
|
-
arm64-darwin
|
|
224
|
-
x86_64-darwin
|
|
225
|
-
x86_64-linux
|
|
226
|
-
|
|
227
|
-
DEPENDENCIES
|
|
228
|
-
markdown_views!
|
|
229
|
-
minitest (~> 6)
|
|
230
|
-
minitest-reporters
|
|
231
|
-
rake
|
|
232
|
-
|
|
233
|
-
BUNDLED WITH
|
|
234
|
-
2.6.9
|
data/markdown_views.gemspec
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'markdown_views/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "markdown_views"
|
|
8
|
-
spec.version = MarkdownViews::VERSION
|
|
9
|
-
spec.authors = ["thomas morgan"]
|
|
10
|
-
spec.email = ["tm@iprog.com"]
|
|
11
|
-
spec.summary = %q{Add .md template handler to Rails.}
|
|
12
|
-
spec.description = %q{Enables Rails handling of .md templates, with optional preprocessing of ERB, HAML, etc. Also provides a markdown() view helper. Uses CommonMarker & Rouge.}
|
|
13
|
-
spec.homepage = "https://github.com/zarqman/markdown_views"
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
-
spec.require_paths = ["lib"]
|
|
20
|
-
|
|
21
|
-
spec.required_ruby_version = '>= 3.1'
|
|
22
|
-
|
|
23
|
-
spec.add_dependency 'commonmarker', '>= 1.1', '< 3.0'
|
|
24
|
-
spec.add_dependency 'rails', '>= 6.1'
|
|
25
|
-
spec.add_dependency 'rouge', '~> 4'
|
|
26
|
-
spec.add_dependency 'securerandom'
|
|
27
|
-
|
|
28
|
-
spec.add_development_dependency "minitest-reporters"
|
|
29
|
-
spec.add_development_dependency "rake"
|
|
30
|
-
end
|
data/test/config_test.rb
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
header_id_prefix_in_href: false,
|
|
16
|
-
footnotes: false,
|
|
17
|
-
inline_footnotes: false,
|
|
18
|
-
description_lists: false,
|
|
19
|
-
front_matter_delimiter: '',
|
|
20
|
-
multiline_block_quotes: false,
|
|
21
|
-
math_dollars: false,
|
|
22
|
-
math_code: false,
|
|
23
|
-
shortcodes: false,
|
|
24
|
-
wikilinks_title_before_pipe: false,
|
|
25
|
-
wikilinks_title_after_pipe: false,
|
|
26
|
-
underline: false,
|
|
27
|
-
spoiler: false,
|
|
28
|
-
greentext: false,
|
|
29
|
-
subscript: false,
|
|
30
|
-
subtext: false,
|
|
31
|
-
alerts: false,
|
|
32
|
-
cjk_friendly_emphasis: true,
|
|
33
|
-
highlight: false,
|
|
34
|
-
insert: false,
|
|
35
|
-
block_directive: false,
|
|
36
|
-
}
|
|
37
|
-
expected.except! :header_id_prefix_in_href, :block_directive if Commonmarker::VERSION < '2.8'
|
|
38
|
-
expected.except! :insert if Commonmarker::VERSION < '2.7'
|
|
39
|
-
assert_equal expected, processed
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_parsing_opts
|
|
43
|
-
processed = Commonmarker::Config.process_options(parse: MarkdownViews.parsing_opts)[:parse]
|
|
44
|
-
expected = {
|
|
45
|
-
smart: true,
|
|
46
|
-
default_info_string: '',
|
|
47
|
-
relaxed_tasklist_matching: false,
|
|
48
|
-
relaxed_autolinks: false,
|
|
49
|
-
leave_footnote_definitions: false,
|
|
50
|
-
ignore_setext: false,
|
|
51
|
-
sourcepos_chars: false,
|
|
52
|
-
}
|
|
53
|
-
expected.except! :sourcepos_chars if Commonmarker::VERSION < '2.8'
|
|
54
|
-
assert_equal expected, processed
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def test_plugins
|
|
58
|
-
processed = Commonmarker::Config.process_plugins(MarkdownViews.plugins)
|
|
59
|
-
expected = {
|
|
60
|
-
syntax_highlighter: nil
|
|
61
|
-
}
|
|
62
|
-
assert_equal expected, processed
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def test_rendering_opts
|
|
66
|
-
processed = Commonmarker::Config.process_options(render: MarkdownViews.rendering_opts)[:render]
|
|
67
|
-
expected = {
|
|
68
|
-
hardbreaks: true,
|
|
69
|
-
github_pre_lang: true,
|
|
70
|
-
full_info_string: false,
|
|
71
|
-
width: 80,
|
|
72
|
-
unsafe: true,
|
|
73
|
-
escape: false,
|
|
74
|
-
sourcepos: false,
|
|
75
|
-
escaped_char_spans: false,
|
|
76
|
-
ignore_empty_links: false,
|
|
77
|
-
gfm_quirks: false,
|
|
78
|
-
prefer_fenced: false,
|
|
79
|
-
tasklist_classes: false,
|
|
80
|
-
compact_html: false,
|
|
81
|
-
}
|
|
82
|
-
expected.except! :compact_html if Commonmarker::VERSION < '2.7'
|
|
83
|
-
assert_equal expected, processed
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
end
|
data/test/render_test.rb
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
def test_integer
|
|
46
|
-
o = <<~HTML
|
|
47
|
-
<p>314</p>
|
|
48
|
-
HTML
|
|
49
|
-
assert_equal o, render(314)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_float
|
|
53
|
-
o = <<~HTML
|
|
54
|
-
<p>3.14</p>
|
|
55
|
-
HTML
|
|
56
|
-
assert_equal o, render(3.14)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def test_bigdecimal
|
|
60
|
-
o = <<~HTML
|
|
61
|
-
<p>3.14</p>
|
|
62
|
-
HTML
|
|
63
|
-
assert_equal o, render(BigDecimal('3.14'))
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_nil
|
|
67
|
-
assert_equal '', render(nil)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def render(*args)
|
|
72
|
-
MarkdownViews::Renderer.render(*args)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
end
|
data/test/strip_comments_test.rb
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
|
|
3
|
-
class StripCommentsTest < Minitest::Test
|
|
4
|
-
|
|
5
|
-
def test_not_greedy
|
|
6
|
-
assert_equal "ace", strip_comments("a<!-- b -->c<!-- d -->e")
|
|
7
|
-
assert_equal "a\nc\nd\nf", strip_comments("a\n<!-- b -->c\nd<!-- e -->\nf")
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# only comment should vanish, without absorbing any outside whitespace
|
|
11
|
-
def test_intra_line_comments
|
|
12
|
-
assert_equal "ac", strip_comments("a<!-- b -->c"), 'no whitespace'
|
|
13
|
-
assert_equal "\nac\n", strip_comments("\na<!-- b -->c\n"), 'no whitespace, with linefeeds'
|
|
14
|
-
assert_equal "a c", strip_comments("a <!-- b -->c"), 'left whitespace'
|
|
15
|
-
assert_equal "a c", strip_comments("a<!-- b --> c"), 'right whitespace'
|
|
16
|
-
assert_equal "a c", strip_comments("a <!-- b --> c"), 'double whitespace'
|
|
17
|
-
assert_equal "ac", strip_comments("a<!--b-->c"), 'comment w/o whitespace'
|
|
18
|
-
assert_equal "a \nc", strip_comments("a <!-- b -->\nc"), 'trailing comment'
|
|
19
|
-
assert_equal "a\n c", strip_comments("a\n<!-- b --> c"), 'leading comment'
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# only comment should vanish, without absorbing outside whitespace
|
|
23
|
-
def test_shared_line_multi_line_comments
|
|
24
|
-
assert_equal "14", strip_comments("1<!-- 2\n3 -->4"), 'no whitespace'
|
|
25
|
-
assert_equal "1 4", strip_comments("1 <!-- 2\n3 --> 4"), 'with whitespace'
|
|
26
|
-
assert_equal "1\n 4", strip_comments("1\n <!-- 2\n3 --> 4"), 'leading whitespace on comment'
|
|
27
|
-
assert_equal "1 \n4", strip_comments("1 <!-- 2\n3 --> \n4"), 'trailing whitespace on comment'
|
|
28
|
-
assert_equal "1 \n 4", strip_comments("1 \n<!-- 2\n3 --> 4"), 'trailing whitespace on line'
|
|
29
|
-
assert_equal "1 \n 4", strip_comments("1 <!-- 2\n3 -->\n 4"), 'leading whitespace on line'
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# should make line vanish, including outside whitespace
|
|
33
|
-
def test_whole_line_single_line_comments
|
|
34
|
-
assert_equal "1\n3\n", strip_comments("1\n<!-- 2 -->\n3\n"), 'adjacent lines'
|
|
35
|
-
assert_equal "1\r\n3\r\n", strip_comments("1\r\n<!-- 2 -->\r\n3\r\n"), 'adjacent lines w/windows LF'
|
|
36
|
-
assert_equal "1\n\n\n3\n", strip_comments("1\n\n<!-- 2 -->\n\n3\n"), 'spaced lines'
|
|
37
|
-
assert_equal " 1\n 3\n", strip_comments(" 1\n <!-- 2 -->\n 3\n"), 'adjacent lines indented w/spaces'
|
|
38
|
-
assert_equal "\t1\n\t3\n", strip_comments("\t1\n\t<!-- 2 -->\n\t3\n"), 'adjacent lines indented w/tabs'
|
|
39
|
-
assert_equal " 1\n\n\n 3\n", strip_comments(" 1\n\n <!-- 2 -->\n\n 3\n"), 'spaced lines indented w/spaces'
|
|
40
|
-
assert_equal "1 \n \n4\t\n", strip_comments("1 \n \n<!-- 2 --> \n<!--3-->\t\n4\t\n"), 'spaced lines w/trailing whitespace'
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# should make all lines vanish, including outside whitespace on same lines
|
|
44
|
-
def test_whole_line_multi_line_comments
|
|
45
|
-
assert_equal "1\n4\n", strip_comments("1\n<!-- 2\n3 -->\n4\n"), 'adjacent lines'
|
|
46
|
-
assert_equal "1\n\n\n4\n", strip_comments("1\n\n<!-- 2\n3 -->\n\n4\n"), 'spaced lines'
|
|
47
|
-
assert_equal " 1\n 4\n", strip_comments(" 1\n <!-- 2\n 3 -->\n 4\n"), 'adjacent lines indented w/spaces'
|
|
48
|
-
assert_equal "1 \n \n4\t\n", strip_comments("1 \n \n<!-- 2 \n3 -->\t\n4\t\n"), 'spaced lines w/trailing whitespace'
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def strip_comments(*args)
|
|
53
|
-
MarkdownViews::Renderer.strip_comments(*args)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
end
|
data/test/test_helper.rb
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
require 'minitest/reporters'
|
|
2
|
-
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
|
5
|
-
require "markdown_views"
|
|
6
|
-
|
|
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
|