docwatch-bin 2.0.1 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa3e636f3b4e862d11696a5aea4b63df99c72bdd759eaeb07f09517653c32323
4
- data.tar.gz: 20536056fbed0a73e38ffb614df419cc3497aae702c114a807de4893ffb09234
3
+ metadata.gz: 3bda63b79dd113e5b7ec2d1ac65d7b2739038d91eca565e3550d5edd786beac9
4
+ data.tar.gz: 471d2e6433a55da559f6d613dcd18e180291d0cdd2fea7222e4f2fa165aaa1fb
5
5
  SHA512:
6
- metadata.gz: f8987d0f03dd42ace0e7ad1ebdf4c8505968890f929f4af27ccb91b7b69f4f45aa9f0051d3228223feccf84de4b0b1c648963982776a0bc6e1bd9b8a9e299075
7
- data.tar.gz: 325f71d82d130fc50b8ac7c688d5f85cd92a2119caccfd751d754257aa6c919e1fa554baa5f044a0ec52c964c01c4b39a449671cfed9a9a2d89865a7d2bc60db
6
+ metadata.gz: 985c8a306134d85d3502d341591b767bcab55c9ab66ead7711ed6b3fbd9fb7ab257616eff402b91110b46c701be4b02f3bc3366259c183dcf800e8897cd60ffb
7
+ data.tar.gz: 7d567a78412f79971a78f91818133baa6df7a31c82d9f4bb325037350c1fed310f7085cdbd7aae957fa7d9760f2cc9e5bdb37bfa4601cd4cd4aa1e468111200e
@@ -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.1'
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,167 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ font-family: sans-serif;
7
+ font-size: 16px;
8
+ color: #444;
9
+ background-color: white;
10
+ max-width: 70ch;
11
+ padding: 0.6rem;
12
+ margin: 0 auto;
13
+ }
14
+
15
+ a {
16
+ text-decoration: none;
17
+ color: #0000b3;
18
+ }
19
+
20
+ a:hover {
21
+ text-decoration: underline;
22
+ }
23
+
24
+ hr {
25
+ border: 1px solid #ccc;
26
+ width: 100%;
27
+ border-bottom: 0;
28
+ margin: 1rem 0;
29
+ }
30
+
31
+ h1 {
32
+ font-size: 20px;
33
+ }
34
+
35
+ h2 {
36
+ font-size: 15px;
37
+ }
38
+
39
+ h1,
40
+ h2,
41
+ p {
42
+ margin: 1rem 0;
43
+ }
44
+
45
+ li,
46
+ p {
47
+ line-height: 1.7rem;
48
+ }
49
+
50
+ code {
51
+ line-height: 1.4rem;
52
+ }
53
+
54
+ pre,
55
+ pre > code {
56
+ font-variant-ligatures: none;
57
+ white-space: pre;
58
+ padding: 0;
59
+ }
60
+
61
+ pre {
62
+ font-variant-ligatures: none;
63
+ border: 1px solid #CBE7F6;
64
+ padding: 0.6rem;
65
+ padding-left: 1rem;
66
+ overflow: auto;
67
+ word-wrap: normal;
68
+ }
69
+
70
+ pre,
71
+ code {
72
+ background-color: #eef7fc;
73
+ font-family: monospace;
74
+ font-size: 13px;
75
+ }
76
+
77
+ code {
78
+ color: #444;
79
+ padding: 2px;
80
+ padding-left: 4px;
81
+ white-space: nowrap;
82
+ }
83
+
84
+ blockquote {
85
+ border: 1px solid #CBE7F6;
86
+ font-style: italic;
87
+ overflow-x: auto;
88
+ margin: 0;
89
+ padding: 0.6rem;
90
+ padding-left: 1rem;
91
+ background-color: #eef7fc;
92
+ }
93
+
94
+ blockquote p:first-child {
95
+ margin-top: 0 !important;
96
+ }
97
+
98
+ blockquote p:last-child {
99
+ margin-bottom: 0 !important;
100
+ }
101
+
102
+ /*
103
+ https://github.com/rouge-ruby/rouge/wiki/List-of-tokens
104
+ */
105
+
106
+ /* Highlighting: Keywords */
107
+ .highlight .k,
108
+ .highlight .kn,
109
+ .highlight .kd,
110
+ .highlight .kp,
111
+ .highlight .kr,
112
+ .highlight .kc,
113
+ .highlight .kt,
114
+ .highlight .kv {
115
+ color: #0000b3;
116
+ }
117
+
118
+ /* Highlighting: Strings */
119
+ .highlight .s,
120
+ .highlight .sa,
121
+ .highlight .se,
122
+ .highlight .sb,
123
+ .highlight .sc,
124
+ .highlight .dl,
125
+ .highlight .sd,
126
+ .highlight .s2,
127
+ .highlight .sh,
128
+ .highlight .sx,
129
+ .highlight .s1 {
130
+ color: #b30000;
131
+ }
132
+
133
+ /* Highlighting: Comments */
134
+ .highlight .c,
135
+ .highlight .cm,
136
+ .highlight .c1,
137
+ .highlight .cs {
138
+ color: green;
139
+ }
140
+
141
+
142
+ table {
143
+ width: 100%;
144
+ }
145
+
146
+ table th {
147
+ font-weight: 600;
148
+ }
149
+
150
+ table td,
151
+ table th {
152
+ padding: 6px 13px;
153
+ border: 1px solid #dfe2e5;
154
+ }
155
+
156
+ table tr {
157
+ background-color: #fff;
158
+ border-top: 1px solid #c6cbd1;
159
+ }
160
+
161
+ table tr:nth-child(2n) {
162
+ background-color: #f6f8fa;
163
+ }
164
+
165
+ table img {
166
+ background-color: initial;
167
+ }
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.1
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
- }