docwatch-bin 2.0.1 → 2.1.0

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: fa3e636f3b4e862d11696a5aea4b63df99c72bdd759eaeb07f09517653c32323
4
- data.tar.gz: 20536056fbed0a73e38ffb614df419cc3497aae702c114a807de4893ffb09234
3
+ metadata.gz: 355efb2dad47b934487b2b29661c144c7f9c46eb00fd3050cb1110bb6cc7bc32
4
+ data.tar.gz: cc80ca6e5dfcedc046a388977accca06897abb80ed84298142edd1f8655bed19
5
5
  SHA512:
6
- metadata.gz: f8987d0f03dd42ace0e7ad1ebdf4c8505968890f929f4af27ccb91b7b69f4f45aa9f0051d3228223feccf84de4b0b1c648963982776a0bc6e1bd9b8a9e299075
7
- data.tar.gz: 325f71d82d130fc50b8ac7c688d5f85cd92a2119caccfd751d754257aa6c919e1fa554baa5f044a0ec52c964c01c4b39a449671cfed9a9a2d89865a7d2bc60db
6
+ metadata.gz: 8faa2fb18a2ae5dbe32a2113433b79f6ffaabc3da20f2daccee27ee6aa48ee01b376d8a7cf02c2e64abeddc95df211f0d3a7f93356a87891eb9829d0161612b1
7
+ data.tar.gz: ac2ca1752b0d419f66cc50bab6cd8782ad182ebc0bdee0538fc2f3deffe810093c8df7774c02c973b3ae038a61d7e8408e0c92dd0c2b9998660d1b94cd8e8a10
@@ -2,8 +2,13 @@ module Docwatch
2
2
  class Renderer::Markdown < Renderer
3
3
  extension :md
4
4
 
5
+ # Rouge::Plugins::Redcarpet provides syntax highlighting support.
6
+ class HtmlRenderer < Redcarpet::Render::HTML
7
+ include Rouge::Plugins::Redcarpet
8
+ end
9
+
5
10
  def head
6
- css = File.read(Docwatch.root_dir + '/res/github-markdown.css')
11
+ css = File.read(Docwatch.root_dir + '/res/styles.css')
7
12
  return <<~EOF
8
13
  <title>#{file_path} - docwatch</title>
9
14
  <style>
@@ -16,6 +21,7 @@ module Docwatch
16
21
  # https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
17
22
  markdown_args = {
18
23
  fenced_code_blocks: true,
24
+ disable_indented_code_blocks: true,
19
25
  tables: true,
20
26
  no_intra_emphasis: true,
21
27
  strikethrough: true,
@@ -39,7 +45,7 @@ module Docwatch
39
45
  end
40
46
 
41
47
  Redcarpet::Markdown.new(
42
- Redcarpet::Render::HTML.new(html_args),
48
+ HtmlRenderer.new(html_args),
43
49
  markdown_args,
44
50
  ).render(document)
45
51
  end
@@ -30,9 +30,7 @@ module Docwatch
30
30
  #{head}
31
31
  </head>
32
32
  <body>
33
- <div class="container">
34
33
  #{body}
35
- </div>
36
34
  <script>
37
35
  (function() {
38
36
  #{js}
@@ -1,3 +1,3 @@
1
1
  module Docwatch
2
- VERSION = '2.0.1'
2
+ VERSION = '2.1.0'
3
3
  end
data/lib/docwatch.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'require_all'
2
+ require 'rouge'
3
+ require 'rouge/plugins/redcarpet'
2
4
  require 'redcarpet'
3
5
  require 'colorize'
4
6
  require 'nokogiri'
data/res/styles.css ADDED
@@ -0,0 +1,166 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ font-variant-ligatures: none;
7
+ font-family: sans-serif;
8
+ font-size: 16px;
9
+ color: #444;
10
+ background-color: white;
11
+ max-width: 70ch;
12
+ padding: 0.6rem;
13
+ margin: 0 auto;
14
+ }
15
+
16
+ a {
17
+ text-decoration: none;
18
+ color: #0000b3;
19
+ }
20
+
21
+ a:hover {
22
+ text-decoration: underline;
23
+ }
24
+
25
+ hr {
26
+ border: 1px solid #ccc;
27
+ width: 100%;
28
+ border-bottom: 0;
29
+ margin: 1rem 0;
30
+ }
31
+
32
+ h1 {
33
+ font-size: 20px;
34
+ }
35
+
36
+ h2 {
37
+ font-size: 15px;
38
+ }
39
+
40
+ h1,
41
+ h2,
42
+ p {
43
+ margin: 1rem 0;
44
+ }
45
+
46
+ li,
47
+ p {
48
+ line-height: 1.7rem;
49
+ }
50
+
51
+ code {
52
+ line-height: 1.4rem;
53
+ }
54
+
55
+ pre,
56
+ pre > code {
57
+ white-space: pre;
58
+ padding: 0;
59
+ }
60
+
61
+ pre {
62
+ border: 1px solid #CBE7F6;
63
+ padding: 0.6rem;
64
+ padding-left: 1rem;
65
+ overflow: auto;
66
+ word-wrap: normal;
67
+ }
68
+
69
+ pre,
70
+ code {
71
+ background-color: #eef7fc;
72
+ font-family: monospace;
73
+ font-size: 13px;
74
+ }
75
+
76
+ code {
77
+ color: #444;
78
+ padding: 2px;
79
+ padding-left: 4px;
80
+ white-space: nowrap;
81
+ }
82
+
83
+ blockquote {
84
+ border: 1px solid #CBE7F6;
85
+ font-style: italic;
86
+ overflow-x: auto;
87
+ margin: 0;
88
+ padding: 0.6rem;
89
+ padding-left: 1rem;
90
+ background-color: #eef7fc;
91
+ }
92
+
93
+ blockquote p:first-child {
94
+ margin-top: 0 !important;
95
+ }
96
+
97
+ blockquote p:last-child {
98
+ margin-bottom: 0 !important;
99
+ }
100
+
101
+ /*
102
+ https://github.com/rouge-ruby/rouge/wiki/List-of-tokens
103
+ */
104
+
105
+ /* Highlighting: Keywords */
106
+ .highlight .k,
107
+ .highlight .kn,
108
+ .highlight .kd,
109
+ .highlight .kp,
110
+ .highlight .kr,
111
+ .highlight .kc,
112
+ .highlight .kt,
113
+ .highlight .kv {
114
+ color: #0000b3;
115
+ }
116
+
117
+ /* Highlighting: Strings */
118
+ .highlight .s,
119
+ .highlight .sa,
120
+ .highlight .se,
121
+ .highlight .sb,
122
+ .highlight .sc,
123
+ .highlight .dl,
124
+ .highlight .sd,
125
+ .highlight .s2,
126
+ .highlight .sh,
127
+ .highlight .sx,
128
+ .highlight .s1 {
129
+ color: #b30000;
130
+ }
131
+
132
+ /* Highlighting: Comments */
133
+ .highlight .c,
134
+ .highlight .cm,
135
+ .highlight .c1,
136
+ .highlight .cs {
137
+ color: green;
138
+ }
139
+
140
+
141
+ table {
142
+ width: 100%;
143
+ }
144
+
145
+ table th {
146
+ font-weight: 600;
147
+ }
148
+
149
+ table td,
150
+ table th {
151
+ padding: 6px 13px;
152
+ border: 1px solid #dfe2e5;
153
+ }
154
+
155
+ table tr {
156
+ background-color: #fff;
157
+ border-top: 1px solid #c6cbd1;
158
+ }
159
+
160
+ table tr:nth-child(2n) {
161
+ background-color: #f6f8fa;
162
+ }
163
+
164
+ table img {
165
+ background-color: initial;
166
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docwatch-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - crdx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-21 00:00:00.000000000 Z
11
+ date: 2022-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rouge
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -142,8 +156,8 @@ files:
142
156
  - lib/docwatch/util/html.rb
143
157
  - lib/docwatch/version.rb
144
158
  - lib/docwatch/watcher.rb
145
- - res/github-markdown.css
146
159
  - res/inject.js
160
+ - res/styles.css
147
161
  homepage: https://github.com/crdx/docwatch
148
162
  licenses:
149
163
  - GPLv3
@@ -1,430 +0,0 @@
1
- .container {
2
- font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
3
- font-size: 16px;
4
- line-height: 1.5;
5
- word-wrap: break-word;
6
- width: 900px;
7
- margin: 0 auto;
8
- }
9
-
10
- .container:after,
11
- .container:before {
12
- display: table;
13
- content: ""
14
- }
15
-
16
- .container:after {
17
- clear: both
18
- }
19
-
20
- .container>:first-child {
21
- margin-top: 0!important
22
- }
23
-
24
- .container>:last-child {
25
- margin-bottom: 0!important
26
- }
27
-
28
- .container a:not([href]) {
29
- color: inherit;
30
- text-decoration: none
31
- }
32
-
33
- .container .absent {
34
- color: #cb2431
35
- }
36
-
37
- .container .anchor {
38
- float: left;
39
- padding-right: 4px;
40
- margin-left: -20px;
41
- line-height: 1
42
- }
43
-
44
- .container .anchor:focus {
45
- outline: none
46
- }
47
-
48
- .container blockquote,
49
- .container details,
50
- .container dl,
51
- .container ol,
52
- .container p,
53
- .container pre,
54
- .container table,
55
- .container ul {
56
- margin-top: 0;
57
- margin-bottom: 16px
58
- }
59
-
60
- .container hr {
61
- height: .25em;
62
- padding: 0;
63
- margin: 24px 0;
64
- background-color: #e1e4e8;
65
- border: 0
66
- }
67
-
68
- .container blockquote {
69
- padding: 0 1em;
70
- color: #6a737d;
71
- border-left: .25em solid #dfe2e5
72
- }
73
-
74
- .container blockquote>:first-child {
75
- margin-top: 0
76
- }
77
-
78
- .container blockquote>:last-child {
79
- margin-bottom: 0
80
- }
81
-
82
- .container kbd {
83
- display: inline-block;
84
- padding: 3px 5px;
85
- font-size: 11px;
86
- line-height: 10px;
87
- color: #444d56;
88
- vertical-align: middle;
89
- background-color: #fafbfc;
90
- border: 1px solid #c6cbd1;
91
- border-bottom-color: #959da5;
92
- border-radius: 3px;
93
- box-shadow: inset 0 -1px 0 #959da5
94
- }
95
-
96
- .container h1,
97
- .container h2,
98
- .container h3,
99
- .container h4,
100
- .container h5,
101
- .container h6 {
102
- margin-top: 24px;
103
- margin-bottom: 16px;
104
- font-weight: 600;
105
- line-height: 1.25
106
- }
107
-
108
- .container h1 .octicon-link,
109
- .container h2 .octicon-link,
110
- .container h3 .octicon-link,
111
- .container h4 .octicon-link,
112
- .container h5 .octicon-link,
113
- .container h6 .octicon-link {
114
- color: #1b1f23;
115
- vertical-align: middle;
116
- visibility: hidden
117
- }
118
-
119
- .container h1:hover .anchor,
120
- .container h2:hover .anchor,
121
- .container h3:hover .anchor,
122
- .container h4:hover .anchor,
123
- .container h5:hover .anchor,
124
- .container h6:hover .anchor {
125
- text-decoration: none
126
- }
127
-
128
- .container h1:hover .anchor .octicon-link,
129
- .container h2:hover .anchor .octicon-link,
130
- .container h3:hover .anchor .octicon-link,
131
- .container h4:hover .anchor .octicon-link,
132
- .container h5:hover .anchor .octicon-link,
133
- .container h6:hover .anchor .octicon-link {
134
- visibility: visible
135
- }
136
-
137
- .container h1 code,
138
- .container h1 tt,
139
- .container h2 code,
140
- .container h2 tt,
141
- .container h3 code,
142
- .container h3 tt,
143
- .container h4 code,
144
- .container h4 tt,
145
- .container h5 code,
146
- .container h5 tt,
147
- .container h6 code,
148
- .container h6 tt {
149
- font-size: inherit
150
- }
151
-
152
- .container h1 {
153
- font-size: 2em
154
- }
155
-
156
- .container h1,
157
- .container h2 {
158
- padding-bottom: .3em;
159
- border-bottom: 1px solid #eaecef
160
- }
161
-
162
- .container h2 {
163
- font-size: 1.5em
164
- }
165
-
166
- .container h3 {
167
- font-size: 1.25em
168
- }
169
-
170
- .container h4 {
171
- font-size: 1em
172
- }
173
-
174
- .container h5 {
175
- font-size: .875em
176
- }
177
-
178
- .container h6 {
179
- font-size: .85em;
180
- color: #6a737d
181
- }
182
-
183
- .container ol,
184
- .container ul {
185
- padding-left: 2em
186
- }
187
-
188
- .container ol.no-list,
189
- .container ul.no-list {
190
- padding: 0;
191
- list-style-type: none
192
- }
193
-
194
- .container ol ol,
195
- .container ol ul,
196
- .container ul ol,
197
- .container ul ul {
198
- margin-top: 0;
199
- margin-bottom: 0
200
- }
201
-
202
- .container li {
203
- word-wrap: break-all
204
- }
205
-
206
- .container li>p {
207
- margin-top: 16px
208
- }
209
-
210
- .container li+li {
211
- margin-top: .25em
212
- }
213
-
214
- .container dl {
215
- padding: 0
216
- }
217
-
218
- .container dl dt {
219
- padding: 0;
220
- margin-top: 16px;
221
- font-size: 1em;
222
- font-style: italic;
223
- font-weight: 600
224
- }
225
-
226
- .container dl dd {
227
- padding: 0 16px;
228
- margin-bottom: 16px
229
- }
230
-
231
- .container table {
232
- display: block;
233
- width: 100%;
234
- overflow: auto
235
- }
236
-
237
- .container table th {
238
- font-weight: 600
239
- }
240
-
241
- .container table td,
242
- .container table th {
243
- padding: 6px 13px;
244
- border: 1px solid #dfe2e5
245
- }
246
-
247
- .container table tr {
248
- background-color: #fff;
249
- border-top: 1px solid #c6cbd1
250
- }
251
-
252
- .container table tr:nth-child(2n) {
253
- background-color: #f6f8fa
254
- }
255
-
256
- .container table img {
257
- background-color: initial
258
- }
259
-
260
- .container img {
261
- max-width: 100%;
262
- box-sizing: initial;
263
- background-color: #fff
264
- }
265
-
266
- .container img[align=right] {
267
- padding-left: 20px
268
- }
269
-
270
- .container img[align=left] {
271
- padding-right: 20px
272
- }
273
-
274
- .container .emoji {
275
- max-width: none;
276
- vertical-align: text-top;
277
- background-color: initial
278
- }
279
-
280
- .container span.frame {
281
- display: block;
282
- overflow: hidden
283
- }
284
-
285
- .container span.frame>span {
286
- display: block;
287
- float: left;
288
- width: auto;
289
- padding: 7px;
290
- margin: 13px 0 0;
291
- overflow: hidden;
292
- border: 1px solid #dfe2e5
293
- }
294
-
295
- .container span.frame span img {
296
- display: block;
297
- float: left
298
- }
299
-
300
- .container span.frame span span {
301
- display: block;
302
- padding: 5px 0 0;
303
- clear: both;
304
- color: #24292e
305
- }
306
-
307
- .container span.align-center {
308
- display: block;
309
- overflow: hidden;
310
- clear: both
311
- }
312
-
313
- .container span.align-center>span {
314
- display: block;
315
- margin: 13px auto 0;
316
- overflow: hidden;
317
- text-align: center
318
- }
319
-
320
- .container span.align-center span img {
321
- margin: 0 auto;
322
- text-align: center
323
- }
324
-
325
- .container span.align-right {
326
- display: block;
327
- overflow: hidden;
328
- clear: both
329
- }
330
-
331
- .container span.align-right>span {
332
- display: block;
333
- margin: 13px 0 0;
334
- overflow: hidden;
335
- text-align: right
336
- }
337
-
338
- .container span.align-right span img {
339
- margin: 0;
340
- text-align: right
341
- }
342
-
343
- .container span.float-left {
344
- display: block;
345
- float: left;
346
- margin-right: 13px;
347
- overflow: hidden
348
- }
349
-
350
- .container span.float-left span {
351
- margin: 13px 0 0
352
- }
353
-
354
- .container span.float-right {
355
- display: block;
356
- float: right;
357
- margin-left: 13px;
358
- overflow: hidden
359
- }
360
-
361
- .container span.float-right>span {
362
- display: block;
363
- margin: 13px auto 0;
364
- overflow: hidden;
365
- text-align: right
366
- }
367
-
368
- .container code,
369
- .container tt {
370
- padding: .2em .4em;
371
- margin: 0;
372
- font-size: 85%;
373
- background-color: rgba(27, 31, 35, .05);
374
- border-radius: 3px
375
- }
376
-
377
- .container code br,
378
- .container tt br {
379
- display: none
380
- }
381
-
382
- .container del code {
383
- text-decoration: inherit
384
- }
385
-
386
- .container pre {
387
- word-wrap: normal
388
- }
389
-
390
- .container pre>code {
391
- padding: 0;
392
- margin: 0;
393
- font-size: 100%;
394
- word-break: normal;
395
- white-space: pre;
396
- background: transparent;
397
- border: 0
398
- }
399
-
400
- .container .highlight {
401
- margin-bottom: 16px
402
- }
403
-
404
- .container .highlight pre {
405
- margin-bottom: 0;
406
- word-break: normal
407
- }
408
-
409
- .container .highlight pre,
410
- .container pre {
411
- padding: 16px;
412
- overflow: auto;
413
- font-size: 85%;
414
- line-height: 1.45;
415
- background-color: #f6f8fa;
416
- border-radius: 3px
417
- }
418
-
419
- .container pre code,
420
- .container pre tt {
421
- display: inline;
422
- max-width: auto;
423
- padding: 0;
424
- margin: 0;
425
- overflow: visible;
426
- line-height: inherit;
427
- word-wrap: normal;
428
- background-color: initial;
429
- border: 0
430
- }