@lowdefy/blocks-markdown 4.0.0-alpha.8 → 4.0.0-alpha.9

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ let DangerousMarkdown = class DangerousMarkdown extends React.Component {
25
25
  id: blockId,
26
26
  className: methods.makeCssClass(properties.style)
27
27
  }, /*#__PURE__*/ React.createElement(ReactMarkdown, {
28
- className: "markdown-body",
28
+ className: "markdown-body markdown-default-code",
29
29
  remarkPlugins: [
30
30
  gfm
31
31
  ],
@@ -44,13 +44,9 @@ let DangerousMarkdown = class DangerousMarkdown extends React.Component {
44
44
  DangerousMarkdown.defaultProps = blockDefaultProps;
45
45
  DangerousMarkdown.meta = {
46
46
  category: 'container',
47
- loading: {
48
- type: 'SkeletonParagraph',
49
- properties: {
50
- lines: 7
51
- }
52
- },
53
47
  icons: [],
54
- styles: []
48
+ styles: [
49
+ 'codeblock.less'
50
+ ]
55
51
  };
56
52
  export default DangerousMarkdown;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ const Markdown = ({ blockId , properties , methods })=>/*#__PURE__*/ React.crea
20
20
  id: blockId,
21
21
  className: methods.makeCssClass(properties.style)
22
22
  }, /*#__PURE__*/ React.createElement(ReactMarkdown, {
23
- className: "markdown-body",
23
+ className: "markdown-body markdown-default-code",
24
24
  skipHtml: properties.skipHtml,
25
25
  remarkPlugins: [
26
26
  gfm
@@ -30,13 +30,9 @@ const Markdown = ({ blockId , properties , methods })=>/*#__PURE__*/ React.crea
30
30
  Markdown.defaultProps = blockDefaultProps;
31
31
  Markdown.meta = {
32
32
  category: 'container',
33
- loading: {
34
- type: 'SkeletonParagraph',
35
- properties: {
36
- lines: 7
37
- }
38
- },
39
33
  icons: [],
40
- styles: []
34
+ styles: [
35
+ 'codeblock.less'
36
+ ]
41
37
  };
42
38
  export default Markdown;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ import { blockDefaultProps } from '@lowdefy/block-utils';
18
18
  import ReactMarkdown from 'react-markdown';
19
19
  import gfm from 'remark-gfm';
20
20
  // See https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/393 for esm issue.
21
- import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github.js';
21
+ import { github } from 'react-syntax-highlighter/dist/cjs/styles/hljs/index.js';
22
22
  import javascript from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript.js';
23
23
  import typescript from 'react-syntax-highlighter/dist/cjs/languages/hljs/typescript.js';
24
24
  import python from 'react-syntax-highlighter/dist/cjs/languages/hljs/python.js';
@@ -28,6 +28,20 @@ import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json.js';
28
28
  import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml.js';
29
29
  import markdown from 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown.js';
30
30
  import handlebars from 'react-syntax-highlighter/dist/cjs/languages/hljs/handlebars.js';
31
+ function _extends() {
32
+ _extends = Object.assign || function(target) {
33
+ for(var i = 1; i < arguments.length; i++){
34
+ var source = arguments[i];
35
+ for(var key in source){
36
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
37
+ target[key] = source[key];
38
+ }
39
+ }
40
+ }
41
+ return target;
42
+ };
43
+ return _extends.apply(this, arguments);
44
+ }
31
45
  SyntaxHighlighter.registerLanguage('handlebars', handlebars.default);
32
46
  SyntaxHighlighter.registerLanguage('nunjucks', handlebars.default);
33
47
  SyntaxHighlighter.registerLanguage('html', handlebars.default);
@@ -44,10 +58,14 @@ SyntaxHighlighter.registerLanguage('ts', typescript.default);
44
58
  SyntaxHighlighter.registerLanguage('xml', xml.default);
45
59
  SyntaxHighlighter.registerLanguage('yaml', yaml.default);
46
60
  const components = {
47
- code: ({ language , children })=>/*#__PURE__*/ React.createElement(SyntaxHighlighter, {
61
+ code ({ inline , className , children , ...props }) {
62
+ return !inline ? /*#__PURE__*/ React.createElement(SyntaxHighlighter, _extends({
48
63
  style: github,
49
- language: language
50
- }, children)
64
+ language: String(className).replace('language-', '')
65
+ }, props), children) : /*#__PURE__*/ React.createElement("code", _extends({
66
+ className: className
67
+ }, props), children);
68
+ }
51
69
  };
52
70
  const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ React.createElement("div", {
53
71
  id: blockId,
@@ -64,12 +82,6 @@ const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ Re
64
82
  MarkdownWithCode.defaultProps = blockDefaultProps;
65
83
  MarkdownWithCode.meta = {
66
84
  category: 'container',
67
- loading: {
68
- type: 'SkeletonParagraph',
69
- properties: {
70
- lines: 7
71
- }
72
- },
73
85
  icons: [],
74
86
  styles: []
75
87
  };
package/dist/blocks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -0,0 +1,14 @@
1
+ .markdown-default-code pre {
2
+ background-color: @background-color-base;
3
+ padding: 0.5em;
4
+ word-wrap: normal;
5
+ }
6
+
7
+ .markdown-default-code pre > code {
8
+ background: transparent;
9
+ border: 0;
10
+ margin: 0;
11
+ padding: 0;
12
+ white-space: pre;
13
+ word-break: normal;
14
+ }
package/dist/style.less CHANGED
@@ -8,14 +8,16 @@
8
8
  .markdown-body h5:hover a,
9
9
  .markdown-body h6:hover a {
10
10
  text-decoration: none;
11
+ color: @heading-color;
11
12
  }
12
13
 
13
14
  .markdown-body {
14
15
  -ms-text-size-adjust: 100%;
15
16
  -webkit-text-size-adjust: 100%;
16
- line-height: 1.55;
17
- font-size: 16px;
18
17
  word-wrap: break-word;
18
+ font-family: @font-family;
19
+ color: @text-color;
20
+ line-height: @line-height-base;
19
21
  }
20
22
 
21
23
  .markdown-body details {
@@ -40,11 +42,6 @@
40
42
  font-weight: bolder;
41
43
  }
42
44
 
43
- .markdown-body h1 {
44
- font-size: 2em;
45
- margin: 0.67em 0;
46
- }
47
-
48
45
  .markdown-body img {
49
46
  border-style: none;
50
47
  }
@@ -52,40 +49,28 @@
52
49
  .markdown-body code,
53
50
  .markdown-body kbd,
54
51
  .markdown-body pre {
55
- font-family: monospace, monospace;
56
- font-size: 1em;
52
+ font-family: @code-family;
53
+ font-size: @font-size-base;
57
54
  }
58
55
 
59
- .markdown-body hr {
60
- box-sizing: content-box;
61
- height: 0;
62
- overflow: visible;
56
+ .markdown-body code {
57
+ background-color: @background-color-base;
63
58
  }
64
59
 
65
- .markdown-body input {
66
- font: inherit;
67
- margin: 0 0.67em 0 0;
60
+ .markdown-body pre {
61
+ margin-bottom: 1em;
68
62
  }
69
63
 
70
- .markdown-body input {
64
+ .markdown-body hr {
65
+ box-sizing: content-box;
66
+ height: 0;
71
67
  overflow: visible;
72
68
  }
73
69
 
74
- .markdown-body [type='checkbox'] {
75
- box-sizing: border-box;
76
- padding: 0;
77
- }
78
-
79
70
  .markdown-body * {
80
71
  box-sizing: border-box;
81
72
  }
82
73
 
83
- .markdown-body input {
84
- font-family: inherit;
85
- font-size: inherit;
86
- line-height: inherit;
87
- }
88
-
89
74
  .markdown-body a {
90
75
  text-decoration: none;
91
76
  }
@@ -101,9 +86,9 @@
101
86
  .markdown-body hr {
102
87
  background: transparent;
103
88
  border: 0;
104
- border-bottom: 1px solid #dfe2e5;
89
+ border-bottom: 1px solid @divider-color;
105
90
  height: 0;
106
- margin: 15px 0;
91
+ margin: 1em 0;
107
92
  overflow: hidden;
108
93
  }
109
94
 
@@ -118,11 +103,6 @@
118
103
  display: table;
119
104
  }
120
105
 
121
- .markdown-body table {
122
- border-collapse: collapse;
123
- border-spacing: 0;
124
- }
125
-
126
106
  .markdown-body td,
127
107
  .markdown-body th {
128
108
  padding: 0;
@@ -132,60 +112,6 @@
132
112
  cursor: pointer;
133
113
  }
134
114
 
135
- .markdown-body h1,
136
- .markdown-body h2,
137
- .markdown-body h3,
138
- .markdown-body h4,
139
- .markdown-body h5,
140
- .markdown-body h6 {
141
- margin-bottom: 0;
142
- margin-top: 0;
143
- }
144
-
145
- .markdown-body h1 {
146
- font-size: 32px;
147
- }
148
-
149
- .markdown-body h1,
150
- .markdown-body h2 {
151
- font-weight: 600;
152
- }
153
-
154
- .markdown-body h2 {
155
- font-size: 24px;
156
- }
157
-
158
- .markdown-body h3 {
159
- font-size: 20px;
160
- }
161
-
162
- .markdown-body h3,
163
- .markdown-body h4 {
164
- font-weight: 600;
165
- }
166
-
167
- .markdown-body h4 {
168
- font-size: 16px;
169
- }
170
-
171
- .markdown-body h5 {
172
- font-size: 14px;
173
- }
174
-
175
- .markdown-body h5,
176
- .markdown-body h6 {
177
- font-weight: 600;
178
- }
179
-
180
- .markdown-body h6 {
181
- font-size: 12px;
182
- }
183
-
184
- .markdown-body p {
185
- margin-bottom: 10px;
186
- margin-top: 0;
187
- }
188
-
189
115
  .markdown-body blockquote {
190
116
  margin: 0;
191
117
  }
@@ -213,17 +139,6 @@
213
139
  margin-left: 0;
214
140
  }
215
141
 
216
- .markdown-body code,
217
- .markdown-body pre {
218
- font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
219
- font-size: 12px;
220
- }
221
-
222
- .markdown-body pre {
223
- margin-bottom: 0;
224
- margin-top: 0;
225
- }
226
-
227
142
  .markdown-body input::-webkit-inner-spin-button,
228
143
  .markdown-body input::-webkit-outer-spin-button {
229
144
  -webkit-appearance: none;
@@ -262,21 +177,22 @@
262
177
  .markdown-body pre,
263
178
  .markdown-body table,
264
179
  .markdown-body ul {
265
- margin-bottom: 16px;
180
+ margin-bottom: 1em;
266
181
  margin-top: 0;
267
182
  }
268
183
 
269
184
  .markdown-body hr {
270
- background-color: #e1e4e8;
185
+ background: transparent;
271
186
  border: 0;
272
- height: 0.25em;
273
- margin: 24px 0;
274
- padding: 0;
187
+ border-bottom: 1px solid @divider-color;
188
+ height: 0;
189
+ margin: 1em 0;
190
+ overflow: hidden;
275
191
  }
276
192
 
277
193
  .markdown-body blockquote {
278
194
  border-left: 0.25em solid #dfe2e5;
279
- color: #6a737d;
195
+ color: @text-color-secondary;
280
196
  padding: 0 1em;
281
197
  }
282
198
 
@@ -296,58 +212,47 @@
296
212
  box-shadow: inset 0 -1px 0 #959da5;
297
213
  color: #444d56;
298
214
  display: inline-block;
299
- font-size: 11px;
300
215
  line-height: 11px;
301
216
  padding: 3px 5px;
302
217
  vertical-align: middle;
303
218
  }
304
219
 
305
- .markdown-body h1,
306
- .markdown-body h2,
307
- .markdown-body h3,
308
- .markdown-body h4,
309
- .markdown-body h5,
310
- .markdown-body h6 {
311
- font-weight: 600;
312
- line-height: 1.3;
313
- margin-bottom: 16px;
314
- margin-top: 24px;
315
- }
316
-
317
- .markdown-body h1 {
318
- font-size: 2em;
319
- }
320
220
 
321
221
  .markdown-body h1,
322
222
  .markdown-body h2 {
323
- border-bottom: 1px solid #eaecef;
223
+ border-bottom: 1px solid @divider-color;
324
224
  padding-bottom: 0.3em;
325
225
  }
326
226
 
227
+ .markdown-body h1 {
228
+ font-size: @heading-1-size;
229
+ }
230
+
327
231
  .markdown-body h2 {
328
- font-size: 1.5em;
232
+ font-size: @heading-2-size;
329
233
  }
330
234
 
331
235
  .markdown-body h3 {
332
- font-size: 1.25em;
236
+ font-size: @heading-3-size;
333
237
  }
334
238
 
335
239
  .markdown-body h4 {
336
- font-size: 1em;
240
+ font-size: @heading-4-size;
337
241
  }
338
242
 
339
243
  .markdown-body h5 {
340
- font-size: 0.875em;
244
+ font-size: @heading-5-size;
341
245
  }
342
246
 
343
247
  .markdown-body h6 {
344
- color: #6a737d;
345
- font-size: 0.85em;
248
+ color: @text-color-secondary;
249
+ font-size: @font-size-base;
346
250
  }
347
251
 
348
252
  .markdown-body ol,
349
253
  .markdown-body ul {
350
- padding-left: 2em;
254
+ padding: @list-item-padding;
255
+ padding-left: 1em;
351
256
  }
352
257
 
353
258
  .markdown-body ol ol,
@@ -363,7 +268,7 @@
363
268
  }
364
269
 
365
270
  .markdown-body li > p {
366
- margin-top: 16px;
271
+ margin-top: 1em;
367
272
  }
368
273
 
369
274
  .markdown-body li + li {
@@ -378,19 +283,22 @@
378
283
  font-size: 1em;
379
284
  font-style: italic;
380
285
  font-weight: 600;
381
- margin-top: 16px;
286
+ margin-top: 1em;
382
287
  padding: 0;
383
288
  }
384
289
 
385
290
  .markdown-body dl dd {
386
- margin-bottom: 16px;
387
- padding: 0 16px;
291
+ margin-bottom: 1em;
292
+ padding: 0 1em;
388
293
  }
389
294
 
390
295
  .markdown-body table {
391
296
  display: block;
392
297
  overflow: auto;
393
298
  width: 100%;
299
+ font-size: @table-font-size;
300
+ border-collapse: collapse;
301
+ border-spacing: 0;
394
302
  }
395
303
 
396
304
  .markdown-body table th {
@@ -399,21 +307,19 @@
399
307
 
400
308
  .markdown-body table td,
401
309
  .markdown-body table th {
402
- border: 1px solid #dfe2e5;
310
+ border: 1px solid @table-border-color;
403
311
  padding: 6px 13px;
404
312
  }
405
313
 
406
314
  .markdown-body table tr {
407
- background-color: #fff;
408
- border-top: 1px solid #c6cbd1;
315
+ border-top: 1px solid @table-border-color;
409
316
  }
410
317
 
411
318
  .markdown-body table tr:nth-child(2n) {
412
- background-color: #f6f8fa;
319
+ background-color: lighten(@table-border-color, 2%);
413
320
  }
414
321
 
415
322
  .markdown-body img {
416
- background-color: #fff;
417
323
  box-sizing: content-box;
418
324
  max-width: 100%;
419
325
  }
@@ -427,32 +333,12 @@
427
333
  }
428
334
 
429
335
  .markdown-body code {
430
- background-color: rgba(27, 31, 35, 0.05);
431
- border-radius: 3px;
432
- font-size: 85%;
433
336
  margin: 0;
434
337
  padding: 0.2em 0.4em;
435
338
  }
436
339
 
437
- .markdown-body pre {
438
- word-wrap: normal;
439
- background-color: rgba(27, 31, 35, 0.05);
440
- border-radius: 3px;
441
- font-size: 85%;
442
- padding: 0.2em 0.4em;
443
- }
444
-
445
- .markdown-body pre > code {
446
- background: transparent;
447
- border: 0;
448
- font-size: 100%;
449
- margin: 0;
450
- padding: 0;
451
- white-space: pre;
452
- word-break: normal;
453
- }
454
-
455
340
  .markdown-body pre code {
341
+ border-radius: 3px;
456
342
  background-color: transparent;
457
343
  border: 0;
458
344
  display: inline;
@@ -465,19 +351,14 @@
465
351
  }
466
352
 
467
353
  .markdown-body kbd {
468
- background-color: #fafbfc;
354
+ background-color: @divider-color;
469
355
  border: 1px solid #d1d5da;
470
- border-bottom-color: #c6cbd1;
356
+ border-bottom-color: darken(@divider-color, 2%);
471
357
  border-radius: 3px;
472
- box-shadow: inset 0 -1px 0 #c6cbd1;
358
+ box-shadow: inset 0 -1px 0 darken(@divider-color, 2%);
473
359
  color: #444d56;
474
360
  display: inline-block;
475
- font: 11px SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace;
476
- line-height: 11px;
361
+ font: @code-family;
477
362
  padding: 3px 5px;
478
363
  vertical-align: middle;
479
364
  }
480
-
481
- .markdown-body hr {
482
- border-bottom-color: #eee;
483
- }
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable import/namespace */ /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-markdown",
3
- "version": "4.0.0-alpha.8",
3
+ "version": "4.0.0-alpha.9",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy markdown blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -47,18 +47,18 @@
47
47
  "test": "jest --coverage"
48
48
  },
49
49
  "dependencies": {
50
- "@lowdefy/block-utils": "4.0.0-alpha.8",
50
+ "@lowdefy/block-utils": "4.0.0-alpha.9",
51
51
  "dompurify": "2.3.5",
52
52
  "react": "17.0.2",
53
53
  "react-dom": "17.0.2",
54
54
  "react-markdown": "8.0.0",
55
- "react-syntax-highlighter": "15.4.5",
55
+ "react-syntax-highlighter": "15.5.0",
56
56
  "rehype-raw": "6.1.1",
57
57
  "remark-gfm": "3.0.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@emotion/jest": "11.7.1",
61
- "@lowdefy/block-dev": "4.0.0-alpha.8",
61
+ "@lowdefy/block-dev": "4.0.0-alpha.9",
62
62
  "@swc/cli": "0.1.55",
63
63
  "@swc/core": "1.2.135",
64
64
  "@swc/jest": "0.2.17",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "9d56b83cf45e868afe3a1eeba750fe826eb74c8c"
76
+ "gitHead": "98b544eca231bdcfca6c3a8601a891835d5ce571"
77
77
  }