mdopen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 82797d1c45873db9090d6d34a7b15c10ce6f74e4
4
+ data.tar.gz: ff00cc0abd9d4158cfb5ba5c2dd436eda306b7e2
5
+ SHA512:
6
+ metadata.gz: ed15a5754aac8459d025287528d0e5e96cbe2542afb85ebea2f9d2fe228d5fbfb02f99094a536a95b22f58f05d709763f1e9275cf75c52a900513be1f05e684b
7
+ data.tar.gz: 2f2ecd77917e390abd92c94afe136e8dc0abc87c896d53f9f5f977404735dbc4b68e55574af6afb6a0fb2a221e1bc768bf9b7d7025c3e39a9342bffc764c9d95
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jhb@laoyouzhibo.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Mdopen
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mdopen`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'mdopen'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install mdopen
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mdopen. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Mdopen project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/mdopen/blob/master/CODE_OF_CONDUCT.md).
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "mdopen"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/mdopen ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ require 'mdopen'
3
+
4
+ def help
5
+ puts <<USAGE
6
+ mdopen is a command tool to preview your Markdown file.
7
+
8
+ Usage: mdopen <markdown_file_path>
9
+
10
+ "README" or "README.md" will be used as input filename if the <markdown_file_path> is omitted.
11
+
12
+ USAGE
13
+ end
14
+
15
+ md_file = if File.exist?(ARGV[0] || "")
16
+ ARGV[0]
17
+ elsif File.exist?("./README")
18
+ "./README"
19
+ elsif File.exist?("./README.md")
20
+ "./README.md"
21
+ end
22
+ help() if md_file.nil?
23
+ Mdopen.preview(File.read(md_file))
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,22 @@
1
+ require 'erb'
2
+
3
+ module Mdopen
4
+ class ErbTemplate
5
+ include ERB::Util
6
+ attr_accessor :content, :template
7
+
8
+ def initialize(content, template)
9
+ @content = content
10
+ @template = template
11
+ end
12
+
13
+ def render()
14
+ ERB.new(@template).result(binding)
15
+ end
16
+
17
+ def save(file)
18
+ File.write(file, render)
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,3 @@
1
+ module Mdopen
2
+ VERSION = "0.1.0"
3
+ end
data/lib/mdopen.rb ADDED
@@ -0,0 +1,51 @@
1
+ require "os"
2
+ require 'redcarpet'
3
+ require 'tempfile'
4
+ require "mdopen/version"
5
+ require "mdopen/erb_template"
6
+
7
+ module Mdopen
8
+ class << self
9
+ def preview(md_file)
10
+ content = md2html(md_file)
11
+ html_file_path = tmp_path
12
+ erb_render(content, html_file_path)
13
+ system "#{open_cmd} file://#{html_file_path}"
14
+ end
15
+
16
+ def erb_render(content, html_file_path)
17
+ erb_t = Mdopen::ErbTemplate.new(content, get_template)
18
+ erb_t.save(html_file_path)
19
+ end
20
+
21
+ def get_template
22
+ template_file = File.join(__dir__, 'templates/github.html.erb')
23
+ File.read(template_file)
24
+ end
25
+
26
+ def md2html(md_file)
27
+ parser = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new, fenced_code_blocks: true)
28
+ parser.render(md_file)
29
+ end
30
+
31
+ def open_cmd
32
+ if OS.mac?
33
+ "open"
34
+ elsif OS.windows?
35
+ "cmd /c start"
36
+ else
37
+ "xdg-open"
38
+ end
39
+ end
40
+
41
+ def tmp_path
42
+ filename = tmp_filename
43
+ tmp = Tempfile.new([filename, ".html"])
44
+ tmp.path
45
+ end
46
+
47
+ def tmp_filename
48
+ [('a'..'z'), ('A'..'Z'), (0..9)].map(&:to_a).flatten.sample(12).join
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,755 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full"></script>
7
+ <style type="text/css">
8
+ /*<![CDATA[*/
9
+ @font-face {
10
+ font-family: octicons-link;
11
+ src: url(data:font/woff;charset=utf-8;base64,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) format('woff');
12
+ }
13
+
14
+ .octicon {
15
+ overflow: hidden;
16
+ vertical-align: text-bottom;
17
+ }
18
+
19
+ .boxed-group {
20
+ width: 980px;
21
+ margin-right: auto;
22
+ margin-left: auto;
23
+ position: relative;
24
+ margin-top: 30px;
25
+ margin-bottom: 30px;
26
+ border-radius: 3px;
27
+
28
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
29
+ -ms-text-size-adjust: 100%;
30
+ -webkit-text-size-adjust: 100%;
31
+ line-height: 1.5;
32
+ color: #24292e;
33
+ font-size: 16px;
34
+ line-height: 1.5;
35
+ word-wrap: break-word;
36
+ }
37
+
38
+ .boxed-group h3 {
39
+ display: block;
40
+ padding: 9px 10px 10px;
41
+ margin: 0;
42
+ font-size: 14px;
43
+ line-height: 17px;
44
+ background-color: #f6f8fa;
45
+ border: 1px solid rgba(27,31,35,0.15);
46
+ border-bottom: 0;
47
+ border-radius: 3px 3px 0 0;
48
+ font-weight: 600;
49
+ }
50
+
51
+ .markdown-body {
52
+ padding: 45px;
53
+ word-wrap: break-word;
54
+ background-color: #fff;
55
+ border: 1px solid #ddd;
56
+ border-bottom-right-radius: 3px;
57
+ border-bottom-left-radius: 3px;
58
+ }
59
+
60
+ .markdown-body .pl-c {
61
+ color: #6a737d;
62
+ }
63
+
64
+ .markdown-body .pl-c1,
65
+ .markdown-body .pl-s .pl-v {
66
+ color: #005cc5;
67
+ }
68
+
69
+ .markdown-body .pl-e,
70
+ .markdown-body .pl-en {
71
+ color: #6f42c1;
72
+ }
73
+
74
+ .markdown-body .pl-smi,
75
+ .markdown-body .pl-s .pl-s1 {
76
+ color: #24292e;
77
+ }
78
+
79
+ .markdown-body .pl-ent {
80
+ color: #22863a;
81
+ }
82
+
83
+ .markdown-body .pl-k {
84
+ color: #d73a49;
85
+ }
86
+
87
+ .markdown-body .pl-s,
88
+ .markdown-body .pl-pds,
89
+ .markdown-body .pl-s .pl-pse .pl-s1,
90
+ .markdown-body .pl-sr,
91
+ .markdown-body .pl-sr .pl-cce,
92
+ .markdown-body .pl-sr .pl-sre,
93
+ .markdown-body .pl-sr .pl-sra {
94
+ color: #032f62;
95
+ }
96
+
97
+ .markdown-body .pl-v,
98
+ .markdown-body .pl-smw {
99
+ color: #e36209;
100
+ }
101
+
102
+ .markdown-body .pl-bu {
103
+ color: #b31d28;
104
+ }
105
+
106
+ .markdown-body .pl-ii {
107
+ color: #fafbfc;
108
+ background-color: #b31d28;
109
+ }
110
+
111
+ .markdown-body .pl-c2 {
112
+ color: #fafbfc;
113
+ background-color: #d73a49;
114
+ }
115
+
116
+ .markdown-body .pl-c2::before {
117
+ content: "^M";
118
+ }
119
+
120
+ .markdown-body .pl-sr .pl-cce {
121
+ font-weight: bold;
122
+ color: #22863a;
123
+ }
124
+
125
+ .markdown-body .pl-ml {
126
+ color: #735c0f;
127
+ }
128
+
129
+ .markdown-body .pl-mh,
130
+ .markdown-body .pl-mh .pl-en,
131
+ .markdown-body .pl-ms {
132
+ font-weight: bold;
133
+ color: #005cc5;
134
+ }
135
+
136
+ .markdown-body .pl-mi {
137
+ font-style: italic;
138
+ color: #24292e;
139
+ }
140
+
141
+ .markdown-body .pl-mb {
142
+ font-weight: bold;
143
+ color: #24292e;
144
+ }
145
+
146
+ .markdown-body .pl-md {
147
+ color: #b31d28;
148
+ background-color: #ffeef0;
149
+ }
150
+
151
+ .markdown-body .pl-mi1 {
152
+ color: #22863a;
153
+ background-color: #f0fff4;
154
+ }
155
+
156
+ .markdown-body .pl-mc {
157
+ color: #e36209;
158
+ background-color: #ffebda;
159
+ }
160
+
161
+ .markdown-body .pl-mi2 {
162
+ color: #f6f8fa;
163
+ background-color: #005cc5;
164
+ }
165
+
166
+ .markdown-body .pl-mdr {
167
+ font-weight: bold;
168
+ color: #6f42c1;
169
+ }
170
+
171
+ .markdown-body .pl-ba {
172
+ color: #586069;
173
+ }
174
+
175
+ .markdown-body .pl-sg {
176
+ color: #959da5;
177
+ }
178
+
179
+ .markdown-body .pl-corl {
180
+ text-decoration: underline;
181
+ color: #032f62;
182
+ }
183
+
184
+ .markdown-body .octicon {
185
+ display: inline-block;
186
+ vertical-align: text-top;
187
+ fill: currentColor;
188
+ }
189
+
190
+ .markdown-body a {
191
+ background-color: transparent;
192
+ }
193
+
194
+ .markdown-body a:active,
195
+ .markdown-body a:hover {
196
+ outline-width: 0;
197
+ }
198
+
199
+ .markdown-body strong {
200
+ font-weight: inherit;
201
+ }
202
+
203
+ .markdown-body strong {
204
+ font-weight: bolder;
205
+ }
206
+
207
+ .markdown-body h1 {
208
+ font-size: 2em;
209
+ margin: 0.67em 0;
210
+ }
211
+
212
+ .markdown-body img {
213
+ border-style: none;
214
+ }
215
+
216
+ .markdown-body code,
217
+ .markdown-body kbd,
218
+ .markdown-body pre {
219
+ font-family: monospace, monospace;
220
+ font-size: 1em;
221
+ }
222
+
223
+ .markdown-body hr {
224
+ box-sizing: content-box;
225
+ height: 0;
226
+ overflow: visible;
227
+ }
228
+
229
+ .markdown-body input {
230
+ font: inherit;
231
+ margin: 0;
232
+ }
233
+
234
+ .markdown-body input {
235
+ overflow: visible;
236
+ }
237
+
238
+ .markdown-body [type="checkbox"] {
239
+ box-sizing: border-box;
240
+ padding: 0;
241
+ }
242
+
243
+ .markdown-body * {
244
+ box-sizing: border-box;
245
+ }
246
+
247
+ .markdown-body input {
248
+ font-family: inherit;
249
+ font-size: inherit;
250
+ line-height: inherit;
251
+ }
252
+
253
+ .markdown-body a {
254
+ color: #0366d6;
255
+ text-decoration: none;
256
+ }
257
+
258
+ .markdown-body a:hover {
259
+ text-decoration: underline;
260
+ }
261
+
262
+ .markdown-body strong {
263
+ font-weight: 600;
264
+ }
265
+
266
+ .markdown-body hr {
267
+ height: 0;
268
+ margin: 15px 0;
269
+ overflow: hidden;
270
+ background: transparent;
271
+ border: 0;
272
+ border-bottom: 1px solid #dfe2e5;
273
+ }
274
+
275
+ .markdown-body hr::before {
276
+ display: table;
277
+ content: "";
278
+ }
279
+
280
+ .markdown-body hr::after {
281
+ display: table;
282
+ clear: both;
283
+ content: "";
284
+ }
285
+
286
+ .markdown-body table {
287
+ border-spacing: 0;
288
+ border-collapse: collapse;
289
+ }
290
+
291
+ .markdown-body td,
292
+ .markdown-body th {
293
+ padding: 0;
294
+ }
295
+
296
+ .markdown-body h1,
297
+ .markdown-body h2,
298
+ .markdown-body h3,
299
+ .markdown-body h4,
300
+ .markdown-body h5,
301
+ .markdown-body h6 {
302
+ margin-top: 0;
303
+ margin-bottom: 0;
304
+ }
305
+
306
+ .markdown-body h1 {
307
+ font-size: 32px;
308
+ font-weight: 600;
309
+ }
310
+
311
+ .markdown-body h2 {
312
+ font-size: 24px;
313
+ font-weight: 600;
314
+ }
315
+
316
+ .markdown-body h3 {
317
+ font-size: 20px;
318
+ font-weight: 600;
319
+ }
320
+
321
+ .markdown-body h4 {
322
+ font-size: 16px;
323
+ font-weight: 600;
324
+ }
325
+
326
+ .markdown-body h5 {
327
+ font-size: 14px;
328
+ font-weight: 600;
329
+ }
330
+
331
+ .markdown-body h6 {
332
+ font-size: 12px;
333
+ font-weight: 600;
334
+ }
335
+
336
+ .markdown-body p {
337
+ margin-top: 0;
338
+ margin-bottom: 10px;
339
+ }
340
+
341
+ .markdown-body blockquote {
342
+ margin: 0;
343
+ }
344
+
345
+ .markdown-body ul,
346
+ .markdown-body ol {
347
+ padding-left: 0;
348
+ margin-top: 0;
349
+ margin-bottom: 0;
350
+ }
351
+
352
+ .markdown-body ol ol,
353
+ .markdown-body ul ol {
354
+ list-style-type: lower-roman;
355
+ }
356
+
357
+ .markdown-body ul ul ol,
358
+ .markdown-body ul ol ol,
359
+ .markdown-body ol ul ol,
360
+ .markdown-body ol ol ol {
361
+ list-style-type: lower-alpha;
362
+ }
363
+
364
+ .markdown-body dd {
365
+ margin-left: 0;
366
+ }
367
+
368
+ .markdown-body code {
369
+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
370
+ font-size: 12px;
371
+ }
372
+
373
+ .markdown-body pre {
374
+ margin-top: 0;
375
+ margin-bottom: 0;
376
+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
377
+ font-size: 12px;
378
+ }
379
+
380
+ .markdown-body .octicon {
381
+ vertical-align: text-bottom;
382
+ }
383
+
384
+ .markdown-body .pl-0 {
385
+ padding-left: 0 !important;
386
+ }
387
+
388
+ .markdown-body .pl-1 {
389
+ padding-left: 4px !important;
390
+ }
391
+
392
+ .markdown-body .pl-2 {
393
+ padding-left: 8px !important;
394
+ }
395
+
396
+ .markdown-body .pl-3 {
397
+ padding-left: 16px !important;
398
+ }
399
+
400
+ .markdown-body .pl-4 {
401
+ padding-left: 24px !important;
402
+ }
403
+
404
+ .markdown-body .pl-5 {
405
+ padding-left: 32px !important;
406
+ }
407
+
408
+ .markdown-body .pl-6 {
409
+ padding-left: 40px !important;
410
+ }
411
+
412
+ .markdown-body::before {
413
+ display: table;
414
+ content: "";
415
+ }
416
+
417
+ .markdown-body::after {
418
+ display: table;
419
+ clear: both;
420
+ content: "";
421
+ }
422
+
423
+ .markdown-body>*:first-child {
424
+ margin-top: 0 !important;
425
+ }
426
+
427
+ .markdown-body>*:last-child {
428
+ margin-bottom: 0 !important;
429
+ }
430
+
431
+ .markdown-body a:not([href]) {
432
+ color: inherit;
433
+ text-decoration: none;
434
+ }
435
+
436
+ .markdown-body .anchor {
437
+ float: left;
438
+ padding-right: 4px;
439
+ margin-left: -20px;
440
+ line-height: 1;
441
+ }
442
+
443
+ .markdown-body .anchor:focus {
444
+ outline: none;
445
+ }
446
+
447
+ .markdown-body p,
448
+ .markdown-body blockquote,
449
+ .markdown-body ul,
450
+ .markdown-body ol,
451
+ .markdown-body dl,
452
+ .markdown-body table,
453
+ .markdown-body pre {
454
+ margin-top: 0;
455
+ margin-bottom: 16px;
456
+ }
457
+
458
+ .markdown-body hr {
459
+ height: 0.25em;
460
+ padding: 0;
461
+ margin: 24px 0;
462
+ background-color: #e1e4e8;
463
+ border: 0;
464
+ }
465
+
466
+ .markdown-body blockquote {
467
+ padding: 0 1em;
468
+ color: #6a737d;
469
+ border-left: 0.25em solid #dfe2e5;
470
+ }
471
+
472
+ .markdown-body blockquote>:first-child {
473
+ margin-top: 0;
474
+ }
475
+
476
+ .markdown-body blockquote>:last-child {
477
+ margin-bottom: 0;
478
+ }
479
+
480
+ .markdown-body kbd {
481
+ display: inline-block;
482
+ padding: 3px 5px;
483
+ font-size: 11px;
484
+ line-height: 10px;
485
+ color: #444d56;
486
+ vertical-align: middle;
487
+ background-color: #fafbfc;
488
+ border: solid 1px #c6cbd1;
489
+ border-bottom-color: #959da5;
490
+ border-radius: 3px;
491
+ box-shadow: inset 0 -1px 0 #959da5;
492
+ }
493
+
494
+ .markdown-body h1,
495
+ .markdown-body h2,
496
+ .markdown-body h3,
497
+ .markdown-body h4,
498
+ .markdown-body h5,
499
+ .markdown-body h6 {
500
+ margin-top: 24px;
501
+ margin-bottom: 16px;
502
+ font-weight: 600;
503
+ line-height: 1.25;
504
+ }
505
+
506
+ .markdown-body h1 .octicon-link,
507
+ .markdown-body h2 .octicon-link,
508
+ .markdown-body h3 .octicon-link,
509
+ .markdown-body h4 .octicon-link,
510
+ .markdown-body h5 .octicon-link,
511
+ .markdown-body h6 .octicon-link {
512
+ color: #1b1f23;
513
+ vertical-align: middle;
514
+ visibility: hidden;
515
+ }
516
+
517
+ .markdown-body h1:hover .anchor,
518
+ .markdown-body h2:hover .anchor,
519
+ .markdown-body h3:hover .anchor,
520
+ .markdown-body h4:hover .anchor,
521
+ .markdown-body h5:hover .anchor,
522
+ .markdown-body h6:hover .anchor {
523
+ text-decoration: none;
524
+ }
525
+
526
+ .markdown-body h1:hover .anchor .octicon-link,
527
+ .markdown-body h2:hover .anchor .octicon-link,
528
+ .markdown-body h3:hover .anchor .octicon-link,
529
+ .markdown-body h4:hover .anchor .octicon-link,
530
+ .markdown-body h5:hover .anchor .octicon-link,
531
+ .markdown-body h6:hover .anchor .octicon-link {
532
+ visibility: visible;
533
+ }
534
+
535
+ .markdown-body h1 {
536
+ padding-bottom: 0.3em;
537
+ font-size: 2em;
538
+ border-bottom: 1px solid #eaecef;
539
+ }
540
+
541
+ .markdown-body h2 {
542
+ padding-bottom: 0.3em;
543
+ font-size: 1.5em;
544
+ border-bottom: 1px solid #eaecef;
545
+ }
546
+
547
+ .markdown-body h3 {
548
+ font-size: 1.25em;
549
+ }
550
+
551
+ .markdown-body h4 {
552
+ font-size: 1em;
553
+ }
554
+
555
+ .markdown-body h5 {
556
+ font-size: 0.875em;
557
+ }
558
+
559
+ .markdown-body h6 {
560
+ font-size: 0.85em;
561
+ color: #6a737d;
562
+ }
563
+
564
+ .markdown-body ul,
565
+ .markdown-body ol {
566
+ padding-left: 2em;
567
+ }
568
+
569
+ .markdown-body ul ul,
570
+ .markdown-body ul ol,
571
+ .markdown-body ol ol,
572
+ .markdown-body ol ul {
573
+ margin-top: 0;
574
+ margin-bottom: 0;
575
+ }
576
+
577
+ .markdown-body li {
578
+ word-wrap: break-all;
579
+ }
580
+
581
+ .markdown-body li>p {
582
+ margin-top: 16px;
583
+ }
584
+
585
+ .markdown-body li+li {
586
+ margin-top: 0.25em;
587
+ }
588
+
589
+ .markdown-body dl {
590
+ padding: 0;
591
+ }
592
+
593
+ .markdown-body dl dt {
594
+ padding: 0;
595
+ margin-top: 16px;
596
+ font-size: 1em;
597
+ font-style: italic;
598
+ font-weight: 600;
599
+ }
600
+
601
+ .markdown-body dl dd {
602
+ padding: 0 16px;
603
+ margin-bottom: 16px;
604
+ }
605
+
606
+ .markdown-body table {
607
+ display: block;
608
+ width: 100%;
609
+ overflow: auto;
610
+ }
611
+
612
+ .markdown-body table th {
613
+ font-weight: 600;
614
+ }
615
+
616
+ .markdown-body table th,
617
+ .markdown-body table td {
618
+ padding: 6px 13px;
619
+ border: 1px solid #dfe2e5;
620
+ }
621
+
622
+ .markdown-body table tr {
623
+ background-color: #fff;
624
+ border-top: 1px solid #c6cbd1;
625
+ }
626
+
627
+ .markdown-body table tr:nth-child(2n) {
628
+ background-color: #f6f8fa;
629
+ }
630
+
631
+ .markdown-body img {
632
+ max-width: 100%;
633
+ box-sizing: content-box;
634
+ background-color: #fff;
635
+ }
636
+
637
+ .markdown-body img[align=right] {
638
+ padding-left: 20px;
639
+ }
640
+
641
+ .markdown-body img[align=left] {
642
+ padding-right: 20px;
643
+ }
644
+
645
+ .markdown-body code {
646
+ padding: 0.2em 0.4em;
647
+ margin: 0;
648
+ font-size: 85%;
649
+ background-color: rgba(27,31,35,0.05);
650
+ border-radius: 3px;
651
+ }
652
+
653
+ .markdown-body pre {
654
+ word-wrap: normal;
655
+ }
656
+
657
+ .markdown-body pre>code {
658
+ padding: 0;
659
+ margin: 0;
660
+ font-size: 100%;
661
+ word-break: normal;
662
+ white-space: pre;
663
+ background: transparent;
664
+ border: 0;
665
+ }
666
+
667
+ .markdown-body .highlight {
668
+ margin-bottom: 16px;
669
+ }
670
+
671
+ .markdown-body .highlight pre {
672
+ margin-bottom: 0;
673
+ word-break: normal;
674
+ }
675
+
676
+ .markdown-body .highlight pre,
677
+ .markdown-body pre {
678
+ padding: 16px;
679
+ overflow: auto;
680
+ font-size: 85%;
681
+ line-height: 1.45;
682
+ background-color: #f6f8fa;
683
+ border-radius: 3px;
684
+ }
685
+
686
+ .markdown-body pre code {
687
+ display: inline;
688
+ max-width: auto;
689
+ padding: 0;
690
+ margin: 0;
691
+ overflow: visible;
692
+ line-height: inherit;
693
+ word-wrap: normal;
694
+ background-color: transparent;
695
+ border: 0;
696
+ }
697
+
698
+ .markdown-body .full-commit .btn-outline:not(:disabled):hover {
699
+ color: #005cc5;
700
+ border-color: #005cc5;
701
+ }
702
+
703
+ .markdown-body kbd {
704
+ display: inline-block;
705
+ padding: 3px 5px;
706
+ font: 11px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
707
+ line-height: 10px;
708
+ color: #444d56;
709
+ vertical-align: middle;
710
+ background-color: #fafbfc;
711
+ border: solid 1px #d1d5da;
712
+ border-bottom-color: #c6cbd1;
713
+ border-radius: 3px;
714
+ box-shadow: inset 0 -1px 0 #c6cbd1;
715
+ }
716
+
717
+ .markdown-body :checked+.radio-label {
718
+ position: relative;
719
+ z-index: 1;
720
+ border-color: #0366d6;
721
+ }
722
+
723
+ .markdown-body .task-list-item {
724
+ list-style-type: none;
725
+ }
726
+
727
+ .markdown-body .task-list-item+.task-list-item {
728
+ margin-top: 3px;
729
+ }
730
+
731
+ .markdown-body .task-list-item input {
732
+ margin: 0 0.2em 0.25em -1.6em;
733
+ vertical-align: middle;
734
+ }
735
+
736
+ .markdown-body hr {
737
+ border-bottom-color: #eee;
738
+ }
739
+ /*]]>*/
740
+ </style>
741
+ <title></title>
742
+ </head>
743
+ <body>
744
+ <div class="boxed-group">
745
+ <h3>
746
+ <svg class="octicon octicon-book" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true">
747
+ <path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path>
748
+ </svg>
749
+ </h3>
750
+ <div class="markdown-body article">
751
+ <%= @content %>
752
+ </div>
753
+ </div>
754
+ </body>
755
+ </html>
data/mdopen.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "mdopen/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "mdopen"
7
+ spec.version = Mdopen::VERSION
8
+ spec.authors = ["B1nj0y"]
9
+ spec.email = ["idegorepl@gmail.com"]
10
+
11
+ spec.summary = %q{mdopen is a command to preview a markdown file.}
12
+ spec.description = %q{mdopen is a command tool to preview a markdown file in a GitHub template.}
13
+ spec.homepage = "https://github.com/beijingrb/mdopen"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = %w[mdopen.gemspec] + Dir["*.md", "bin/*", "lib/**/*.rb", "lib/templates/*.erb"]
17
+ spec.require_paths = ["lib"]
18
+ spec.executables = %w[mdopen]
19
+
20
+ spec.add_dependency "os", "~> 1.0"
21
+ spec.add_dependency "redcarpet", "~> 3.4"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.16"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mdopen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - B1nj0y
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: os
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: redcarpet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ description: mdopen is a command tool to preview a markdown file in a GitHub template.
70
+ email:
71
+ - idegorepl@gmail.com
72
+ executables:
73
+ - mdopen
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - CODE_OF_CONDUCT.md
78
+ - README.md
79
+ - bin/console
80
+ - bin/mdopen
81
+ - bin/setup
82
+ - lib/mdopen.rb
83
+ - lib/mdopen/erb_template.rb
84
+ - lib/mdopen/version.rb
85
+ - lib/templates/github.html.erb
86
+ - mdopen.gemspec
87
+ homepage: https://github.com/beijingrb/mdopen
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.5.2
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: mdopen is a command to preview a markdown file.
111
+ test_files: []