action_markdown 0.1.1 → 0.1.2

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: f8c962323d1ff2acea1e7e1df96ba96ea2eebe94e2b526d03246f3f4c0390dbb
4
- data.tar.gz: b18cb4ea30a5a93c0e0c7c0c28aa65869ce82c8ad32f8fa0c72d9d32a88881ef
3
+ metadata.gz: 914e4bf003d2d90a96ceb63bd26cb06aad85f3d0f071eaaefaacbbfc49eb1628
4
+ data.tar.gz: 7b65f6e453de6c04b24bcbaff52bb98cc6550e461e52951e383b364d5c18a0da
5
5
  SHA512:
6
- metadata.gz: 1519877f07359986e7379461440048336dd8c9154dc048c008ca05d69c43c4f594ffc7780464676f8e9efac8dace61d33c3f6af11d4864a43d99096915c8f2da
7
- data.tar.gz: d44aaeff14fbdc4396ec4b02d779c10cbab4fec3d0c1c1e9032834de78b4b49027a13bda3b017fe2e91f88ae4002bd576fd7ef4d9d810dae3e71737f6bfbe1fd
6
+ metadata.gz: 0b40284e3ea4ab89c47a407457a832fa76338bd1ab89310556e9e5eda5c15689d4b8dd11c68f32925ab86ec5681907f7c7948c67bb7658e393758e7ecab80ac6
7
+ data.tar.gz: 319d898b6af736bf7e391030117ec456ea3d9ae7c2fbb71f021e3bdd947eb125b85d6a26db39b12aab9f745f708c9a3d3708f17289b10206bf3c2ff3bf852dd4
@@ -0,0 +1,313 @@
1
+ .action-markdown {
2
+ /* Inline code variables */
3
+ --am-inline-code-padding-y: 0.15rem;
4
+ --am-inline-code-padding-x: 0.2rem;
5
+ --am-inline-code-border-radius: 0.375rem;
6
+ --am-inline-code-background: hsl(53 100% 65% / 0.2);
7
+
8
+ /* Code block paddings */
9
+ --am-code-padding-y: 1rem;
10
+ --am-code-padding-x: 1.5rem;
11
+
12
+ /* Code block border-radius */
13
+ --am-code-border-radius: 0.5rem;
14
+
15
+ /* Code block shadow */
16
+ --am-code-shadow: 1px 3px 6px hsl(0 0% 0% / 0.1);
17
+
18
+ /* Code syntax highlighting variables */
19
+ --am-code-background:hsl(208 95% 8%);
20
+ --am-code-comment: hsl(180 9% 43%);
21
+ --am-code-string: hsl(35 71% 74%);
22
+ --am-code-inherit: hsl(77 67% 68%);
23
+ --am-code-number: hsl(14 90% 70%);
24
+ --am-code-error: hsl(357 79% 65%);
25
+ --am-code-constant: hsl(221 100% 75%);
26
+ --am-code-keyword: hsl(276 68% 75%);
27
+ --am-code-class: hsl(33 100% 77%);
28
+ --am-code-variable: hsl(169 56% 68%);
29
+ --am-code-text: hsl(217 34% 88%);
30
+ --am-code-html: hsl(169 47% 86%);
31
+ }
32
+
33
+ .action-markdown p code,
34
+ .action-markdown li code {
35
+ color: inherit;
36
+ border-radius: var(--am-inline-code-border-radius);
37
+ background-color: var(--am-inline-code-background);
38
+ padding: var(--am-inline-code-padding-y) var(--am-inline-code-padding-x);
39
+ }
40
+
41
+ .action-markdown div.highlight {
42
+ overflow: auto;
43
+ background-color: var(--am-code-background);
44
+ border-radius: var(--am-code-border-radius);
45
+ box-shadow: var(--am-code-shadow);
46
+ }
47
+
48
+ .action-markdown pre.highlight {
49
+ margin: 0;
50
+ float: left;
51
+ padding: var(--am-code-padding-y) var(--am-code-padding-x);
52
+ }
53
+
54
+ .action-markdown .highlight code {
55
+ color: var(--am-code-text);
56
+ }
57
+
58
+ .action-markdown .highlight .cm {
59
+ color: var(--am-code-comment);
60
+ }
61
+
62
+ .action-markdown .highlight .p {
63
+ color: var(--am-code-comment);
64
+ }
65
+
66
+ .action-markdown .highlight .cp {
67
+ color: var(--am-code-error);
68
+ }
69
+
70
+ .action-markdown .highlight .c1 {
71
+ color: var(--am-code-comment);
72
+ }
73
+
74
+ .action-markdown .highlight .cs {
75
+ color: var(--am-code-comment);
76
+ }
77
+
78
+ .action-markdown .highlight .c,
79
+ .action-markdown .highlight .ch,
80
+ .action-markdown .highlight .cd,
81
+ .action-markdown .highlight .cpf {
82
+ color: var(--am-code-comment);
83
+ }
84
+
85
+ .action-markdown .highlight .err {
86
+ color: var(--am-code-keyword);
87
+ }
88
+
89
+ .action-markdown .highlight .gd {
90
+ color: var(--am-code-keyword);
91
+ }
92
+
93
+ .action-markdown .highlight .ge {
94
+ color: var(--am-code-keyword);
95
+ }
96
+
97
+ .action-markdown .highlight .gr {
98
+ color: var(--am-code-error);
99
+ }
100
+
101
+ .action-markdown .highlight .gh {
102
+ color: var(--am-code-comment);
103
+ }
104
+
105
+ .action-markdown .highlight .gi {
106
+ color: var(--am-code-keyword);
107
+ }
108
+
109
+ .action-markdown .highlight .go {
110
+ color: var(--am-code-comment);
111
+ }
112
+
113
+ .action-markdown .highlight .gp {
114
+ color: var(--am-code-comment);
115
+ }
116
+
117
+ .action-markdown .highlight .gu {
118
+ color: var(--am-code-comment);
119
+ }
120
+
121
+ .action-markdown .highlight .gt {
122
+ color: var(--am-code-error);
123
+ }
124
+ .action-markdown .highlight .kc {
125
+ color: var(--am-code-keyword);
126
+ }
127
+
128
+ .action-markdown .highlight .kd {
129
+ color: var(--am-code-keyword);
130
+ }
131
+
132
+ .action-markdown .highlight .kn {
133
+ color: var(--am-code-keyword);
134
+ }
135
+
136
+ .action-markdown .highlight .kp {
137
+ color: var(--am-code-keyword);
138
+ }
139
+
140
+ .action-markdown .highlight .kr {
141
+ color: var(--am-code-keyword);
142
+ }
143
+
144
+ .action-markdown .highlight .kt {
145
+ color: var(--am-code-class);
146
+ }
147
+
148
+ .action-markdown .highlight .k,
149
+ .action-markdown .highlight .kv {
150
+ color: var(--am-code-keyword);
151
+ }
152
+
153
+ .action-markdown .highlight .mf {
154
+ color: var(--am-code-number);
155
+ }
156
+
157
+ .action-markdown .highlight .mh {
158
+ color: var(--am-code-number);
159
+ }
160
+
161
+ .action-markdown .highlight .il {
162
+ color: var(--am-code-number);
163
+ }
164
+
165
+ .action-markdown .highlight .mi {
166
+ color: var(--am-code-number);
167
+ }
168
+
169
+ .action-markdown .highlight .mo {
170
+ color: var(--am-code-number);
171
+ }
172
+
173
+ .action-markdown .highlight .m,
174
+ .action-markdown .highlight .mb,
175
+ .action-markdown .highlight .mx {
176
+ color: var(--am-code-number);
177
+ }
178
+
179
+ .action-markdown .highlight .sa {
180
+ color: var(--am-code-keyword);
181
+ }
182
+
183
+ .action-markdown .highlight .sb {
184
+ color: var(--am-code-string);
185
+ }
186
+
187
+ .action-markdown .highlight .sc {
188
+ color: var(--am-code-string);
189
+ }
190
+
191
+ .action-markdown .highlight .sd {
192
+ color: var(--am-code-string);
193
+ }
194
+
195
+ .action-markdown .highlight .s2 {
196
+ color: var(--am-code-string);
197
+ }
198
+
199
+ .action-markdown .highlight .se {
200
+ color: var(--am-code-string);
201
+ }
202
+
203
+ .action-markdown .highlight .sh {
204
+ color: var(--am-code-string);
205
+ }
206
+
207
+ .action-markdown .highlight .si {
208
+ color: var(--am-code-string);
209
+ }
210
+
211
+ .action-markdown .highlight .sx {
212
+ color: var(--am-code-string);
213
+ }
214
+
215
+ .action-markdown .highlight .sr {
216
+ color: var(--am-code-inherit);
217
+ }
218
+
219
+ .action-markdown .highlight .s1 {
220
+ color: var(--am-code-string);
221
+ }
222
+
223
+ .action-markdown .highlight .ss {
224
+ color: var(--am-code-variable);
225
+ }
226
+
227
+ .action-markdown .highlight .s,
228
+ .action-markdown .highlight .dl {
229
+ color: var(--am-code-string);
230
+ }
231
+
232
+ .action-markdown .highlight .na {
233
+ color: var(--am-code-inherit);
234
+ }
235
+
236
+ .action-markdown .highlight .bp {
237
+ color: var(--am-code-comment);
238
+ }
239
+
240
+ .action-markdown .highlight .nb {
241
+ color: var(--am-code-text);
242
+ }
243
+
244
+ .action-markdown .highlight .nc {
245
+ color: var(--am-code-class);
246
+ }
247
+
248
+ .action-markdown .highlight .no {
249
+ color: var(--am-code-inherit);
250
+ }
251
+
252
+ .action-markdown .highlight .nd {
253
+ color: var(--am-code-keyword);
254
+ }
255
+
256
+ .action-markdown .highlight .ni {
257
+ color: var(--am-code-constant);
258
+ }
259
+
260
+ .action-markdown .highlight .ne {
261
+ color: var(--am-code-constant);
262
+ }
263
+
264
+ .action-markdown .highlight .nf,
265
+ .action-markdown .highlight .fm {
266
+ color: var(--am-code-constant);
267
+ }
268
+
269
+ .action-markdown .highlight .nl {
270
+ color: var(--am-code-constant);
271
+ }
272
+
273
+ .action-markdown .highlight .nn {
274
+ color: var(--am-code-inherit);
275
+ }
276
+
277
+ .action-markdown .highlight .nt {
278
+ color: var(--am-code-html);
279
+ }
280
+
281
+ .action-markdown .highlight .n,
282
+ .action-markdown .highlight .p {
283
+ color: var(--am-code-text);
284
+ }
285
+
286
+ .action-markdown .highlight .vc {
287
+ color: var(--am-code-inherit);
288
+ }
289
+
290
+ .action-markdown .highlight .vg {
291
+ color: var(--am-code-inherit);
292
+ }
293
+
294
+ .action-markdown .highlight .vi {
295
+ color: var(--am-code-inherit);
296
+ }
297
+
298
+ .action-markdown .highlight .nv,
299
+ .action-markdown .highlight .vm {
300
+ color: var(--am-code-inherit);
301
+ }
302
+
303
+ .action-markdown .highlight .ow {
304
+ color: var(--am-code-keyword);
305
+ }
306
+
307
+ .action-markdown .highlight .o {
308
+ color: var(--am-code-keyword);
309
+ }
310
+
311
+ .action-markdown .highlight .w {
312
+ color: var(--am-code-comment);
313
+ }
@@ -1 +1,3 @@
1
- <%= sanitize content.to_html %>
1
+ <div class="action-markdown">
2
+ <%= sanitize content.to_html %>
3
+ </div>
@@ -6,6 +6,10 @@ module ActionMarkdown
6
6
  @body = body
7
7
  end
8
8
 
9
+ def to_markdown
10
+ body
11
+ end
12
+
9
13
  def to_html
10
14
  markdown_renderer.render(body)
11
15
  end
@@ -14,11 +14,11 @@ module ActionMarkdown
14
14
  when nil
15
15
  nil
16
16
  when self
17
- content.to_html
17
+ content.to_markdown
18
18
  when ActionMarkdown::MarkdownText
19
- content.body.to_html
19
+ content.body.to_markdown
20
20
  else
21
- new(content).to_html
21
+ new(content).to_markdown
22
22
  end
23
23
  end
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module ActionMarkdown
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -2,6 +2,7 @@ require "action_markdown/version"
2
2
  require "action_markdown/engine"
3
3
 
4
4
  require "redcarpet"
5
+ require "rouge"
5
6
 
6
7
  module ActionMarkdown
7
8
  extend ActiveSupport::Autoload
@@ -1,9 +1,23 @@
1
1
  module ActionMarkdown
2
2
  module Generators
3
3
  class InstallGenerator < ::Rails::Generators::Base
4
+ source_root ActionMarkdown::Engine.root
5
+
4
6
  def create_migrations
5
7
  rails_command "railties:install:migrations FROM=action_markdown", inline: true
6
8
  end
9
+
10
+ def create_action_markdown_files
11
+ copy_file(
12
+ "app/assets/stylesheets/action_markdown/action_markdown.css",
13
+ "app/assets/stylesheets/action_markdown.css"
14
+ )
15
+
16
+ copy_file(
17
+ "app/views/action_markdown/contents/_content.html.erb",
18
+ "app/views/action_markdown/contents/_content.html.erb"
19
+ )
20
+ end
7
21
  end
8
22
  end
9
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Ruban
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-27 00:00:00.000000000 Z
11
+ date: 2022-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - MIT-LICENSE
63
63
  - README.md
64
+ - app/assets/stylesheets/action_markdown/action_markdown.css
64
65
  - app/models/action_markdown/application_record.rb
65
66
  - app/models/action_markdown/markdown_text.rb
66
67
  - app/views/action_markdown/contents/_content.html.erb