@lowdefy/blocks-markdown 4.0.0-alpha.1 → 4.0.0-alpha.12

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,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -18,22 +17,23 @@ import DOMPurify from 'dompurify';
18
17
  import { blockDefaultProps } from '@lowdefy/block-utils';
19
18
  import ReactMarkdown from 'react-markdown';
20
19
  import gfm from 'remark-gfm';
20
+ import rehypeRaw from 'rehype-raw';
21
21
  let DangerousMarkdown = class DangerousMarkdown extends React.Component {
22
22
  render() {
23
23
  const { blockId , properties , methods } = this.props;
24
- return(/*#__PURE__*/ _jsx("div", {
24
+ return(/*#__PURE__*/ React.createElement("div", {
25
25
  id: blockId,
26
- className: methods.makeCssClass(properties.style),
27
- children: /*#__PURE__*/ _jsx(ReactMarkdown, {
28
- className: "markdown-body",
29
- plugins: [
30
- gfm
31
- ],
32
- allowDangerousHtml: true,
33
- skipHtml: false,
34
- children: DOMPurify.sanitize(this.props.properties.content, this.DOMPurifyOptions)
35
- })
36
- }));
26
+ className: methods.makeCssClass(properties.style)
27
+ }, /*#__PURE__*/ React.createElement(ReactMarkdown, {
28
+ className: "markdown-body markdown-default-code",
29
+ remarkPlugins: [
30
+ gfm
31
+ ],
32
+ rehypePlugins: [
33
+ rehypeRaw
34
+ ],
35
+ skipHtml: false
36
+ }, DOMPurify.sanitize(this.props.properties.content, this.DOMPurifyOptions))));
37
37
  }
38
38
  constructor(props){
39
39
  super(props);
@@ -42,4 +42,11 @@ let DangerousMarkdown = class DangerousMarkdown extends React.Component {
42
42
  }
43
43
  };
44
44
  DangerousMarkdown.defaultProps = blockDefaultProps;
45
+ DangerousMarkdown.meta = {
46
+ category: 'container',
47
+ icons: [],
48
+ styles: [
49
+ 'codeblock.less'
50
+ ]
51
+ };
45
52
  export default DangerousMarkdown;
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -17,18 +16,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
17
16
  import { blockDefaultProps } from '@lowdefy/block-utils';
18
17
  import ReactMarkdown from 'react-markdown';
19
18
  import gfm from 'remark-gfm';
20
- const Markdown = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx("div", {
19
+ const Markdown = ({ blockId , properties , methods })=>/*#__PURE__*/ React.createElement("div", {
21
20
  id: blockId,
22
- className: methods.makeCssClass(properties.style),
23
- children: /*#__PURE__*/ _jsx(ReactMarkdown, {
24
- className: "markdown-body",
25
- plugins: [
26
- gfm
27
- ],
28
- skipHtml: properties.skipHtml,
29
- children: properties.content
30
- })
31
- })
21
+ className: methods.makeCssClass(properties.style)
22
+ }, /*#__PURE__*/ React.createElement(ReactMarkdown, {
23
+ className: "markdown-body markdown-default-code",
24
+ skipHtml: properties.skipHtml,
25
+ remarkPlugins: [
26
+ gfm
27
+ ]
28
+ }, properties.content))
32
29
  ;
33
30
  Markdown.defaultProps = blockDefaultProps;
31
+ Markdown.meta = {
32
+ category: 'container',
33
+ icons: [],
34
+ styles: [
35
+ 'codeblock.less'
36
+ ]
37
+ };
34
38
  export default Markdown;
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  /*
3
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
4
3
 
5
4
  Licensed under the Apache License, Version 2.0 (the "License");
6
5
  you may not use this file except in compliance with the License.
@@ -18,51 +17,72 @@ import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
18
17
  import { blockDefaultProps } from '@lowdefy/block-utils';
19
18
  import ReactMarkdown from 'react-markdown';
20
19
  import gfm from 'remark-gfm';
21
- import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
22
- import javascript from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript';
23
- import typescript from 'react-syntax-highlighter/dist/cjs/languages/hljs/typescript';
24
- import python from 'react-syntax-highlighter/dist/cjs/languages/hljs/python';
25
- import java from 'react-syntax-highlighter/dist/cjs/languages/hljs/java';
26
- import xml from 'react-syntax-highlighter/dist/cjs/languages/hljs/xml';
27
- import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json';
28
- import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml';
29
- import markdown from 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown';
30
- import handlebars from 'react-syntax-highlighter/dist/cjs/languages/hljs/handlebars';
31
- SyntaxHighlighter.registerLanguage('javascript', javascript);
32
- SyntaxHighlighter.registerLanguage('js', javascript);
33
- SyntaxHighlighter.registerLanguage('jsx', javascript);
34
- SyntaxHighlighter.registerLanguage('typescript', typescript);
35
- SyntaxHighlighter.registerLanguage('ts', typescript);
36
- SyntaxHighlighter.registerLanguage('python', python);
37
- SyntaxHighlighter.registerLanguage('py', python);
38
- SyntaxHighlighter.registerLanguage('java', java);
39
- SyntaxHighlighter.registerLanguage('xml', xml);
40
- SyntaxHighlighter.registerLanguage('json', json);
41
- SyntaxHighlighter.registerLanguage('yaml', yaml);
42
- SyntaxHighlighter.registerLanguage('markdown', markdown);
43
- SyntaxHighlighter.registerLanguage('handlebars', handlebars);
44
- SyntaxHighlighter.registerLanguage('nunjucks', handlebars);
45
- SyntaxHighlighter.registerLanguage('html', handlebars);
46
- const renderers = {
47
- code: ({ language , value })=>/*#__PURE__*/ _jsx(SyntaxHighlighter, {
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/index.js';
22
+ import javascript from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript.js';
23
+ import typescript from 'react-syntax-highlighter/dist/cjs/languages/hljs/typescript.js';
24
+ import python from 'react-syntax-highlighter/dist/cjs/languages/hljs/python.js';
25
+ import java from 'react-syntax-highlighter/dist/cjs/languages/hljs/java.js';
26
+ import xml from 'react-syntax-highlighter/dist/cjs/languages/hljs/xml.js';
27
+ import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json.js';
28
+ import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml.js';
29
+ import markdown from 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown.js';
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
+ }
45
+ SyntaxHighlighter.registerLanguage('handlebars', handlebars.default);
46
+ SyntaxHighlighter.registerLanguage('nunjucks', handlebars.default);
47
+ SyntaxHighlighter.registerLanguage('html', handlebars.default);
48
+ SyntaxHighlighter.registerLanguage('java', java.default);
49
+ SyntaxHighlighter.registerLanguage('javascript', javascript.default);
50
+ SyntaxHighlighter.registerLanguage('js', javascript.default);
51
+ SyntaxHighlighter.registerLanguage('jsx', javascript.default);
52
+ SyntaxHighlighter.registerLanguage('json', json.default);
53
+ SyntaxHighlighter.registerLanguage('markdown', markdown.default);
54
+ SyntaxHighlighter.registerLanguage('python', python.default);
55
+ SyntaxHighlighter.registerLanguage('py', python.default);
56
+ SyntaxHighlighter.registerLanguage('typescript', typescript.default);
57
+ SyntaxHighlighter.registerLanguage('ts', typescript.default);
58
+ SyntaxHighlighter.registerLanguage('xml', xml.default);
59
+ SyntaxHighlighter.registerLanguage('yaml', yaml.default);
60
+ const components = {
61
+ code ({ inline , className , children , ...props }) {
62
+ return !inline ? /*#__PURE__*/ React.createElement(SyntaxHighlighter, _extends({
48
63
  style: github,
49
- language: language,
50
- children: value
51
- })
64
+ language: String(className).replace('language-', '')
65
+ }, props), children) : /*#__PURE__*/ React.createElement("code", _extends({
66
+ className: className
67
+ }, props), children);
68
+ }
52
69
  };
53
- const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx("div", {
70
+ const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ React.createElement("div", {
54
71
  id: blockId,
55
- className: methods.makeCssClass(properties.style),
56
- children: /*#__PURE__*/ _jsx(ReactMarkdown, {
57
- className: "markdown-body",
58
- renderers: renderers,
59
- plugins: [
60
- gfm
61
- ],
62
- skipHtml: properties.skipHtml,
63
- children: properties.content
64
- })
65
- })
72
+ className: methods.makeCssClass(properties.style)
73
+ }, /*#__PURE__*/ React.createElement(ReactMarkdown, {
74
+ className: "markdown-body",
75
+ skipHtml: properties.skipHtml,
76
+ remarkPlugins: [
77
+ gfm
78
+ ],
79
+ components: components
80
+ }, properties.content))
66
81
  ;
67
82
  MarkdownWithCode.defaultProps = blockDefaultProps;
83
+ MarkdownWithCode.meta = {
84
+ category: 'container',
85
+ icons: [],
86
+ styles: []
87
+ };
68
88
  export default MarkdownWithCode;
package/dist/blocks.js ADDED
@@ -0,0 +1,17 @@
1
+ /*
2
+ Copyright 2020-2022 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ export { default as DangerousMarkdown } from './blocks/DangerousMarkdown/DangerousMarkdown.js';
16
+ export { default as Markdown } from './blocks/Markdown/Markdown.js';
17
+ export { default as MarkdownWithCode } from './blocks/MarkdownWithCode/MarkdownWithCode.js';
@@ -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
- }
@@ -1,5 +1,5 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
1
+ /* eslint-disable import/namespace */ /*
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.
@@ -12,18 +12,20 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import DangerousMarkdown from './blocks/DangerousMarkdown';
16
- import Markdown from './blocks/Markdown';
17
- import MarkdownWithCode from './blocks/MarkdownWithCode';
15
+ */ import * as blocks from './blocks.js';
16
+ const icons = {};
17
+ const styles = {};
18
+ Object.keys(blocks).forEach((block)=>{
19
+ icons[block] = blocks[block].meta.icons || [];
20
+ styles[block] = blocks[block].meta.styles || [];
21
+ });
18
22
  export default {
19
- blocks: {
20
- DangerousMarkdown,
21
- Markdown,
22
- MarkdownWithCode
23
- },
24
- import: {
25
- styles: [
23
+ blocks: Object.keys(blocks),
24
+ icons,
25
+ styles: {
26
+ default: [
26
27
  'style.less'
27
- ]
28
+ ],
29
+ ...styles
28
30
  }
29
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-markdown",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.12",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy markdown blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -8,7 +8,8 @@
8
8
  "lowdefy",
9
9
  "lowdefy blocks",
10
10
  "markdown",
11
- "react-markdown"
11
+ "react-markdown",
12
+ "lowdefy plugin"
12
13
  ],
13
14
  "bugs": {
14
15
  "url": "https://github.com/lowdefy/lowdefy/issues"
@@ -28,7 +29,11 @@
28
29
  "url": "https://github.com/lowdefy/lowdefy.git"
29
30
  },
30
31
  "type": "module",
31
- "exports": "./dist/index.js",
32
+ "exports": {
33
+ "./*": "./dist/*",
34
+ "./blocks": "./dist/blocks.js",
35
+ "./types": "./dist/types.js"
36
+ },
32
37
  "files": [
33
38
  "dist/*"
34
39
  ],
@@ -42,31 +47,31 @@
42
47
  "test": "jest --coverage"
43
48
  },
44
49
  "dependencies": {
45
- "@lowdefy/block-utils": "4.0.0-alpha.1",
46
- "dompurify": "2.3.3",
47
- "react": "18.0.0-alpha-327d5c484-20211106",
48
- "react-dom": "18.0.0-alpha-327d5c484-20211106",
49
- "react-markdown": "5.0.3",
50
- "react-syntax-highlighter": "15.4.4",
51
- "remark-gfm": "1.0.0"
50
+ "@lowdefy/block-utils": "4.0.0-alpha.12",
51
+ "dompurify": "2.3.5",
52
+ "react": "17.0.2",
53
+ "react-dom": "17.0.2",
54
+ "react-markdown": "8.0.0",
55
+ "react-syntax-highlighter": "15.5.0",
56
+ "rehype-raw": "6.1.1",
57
+ "remark-gfm": "3.0.1"
52
58
  },
53
59
  "devDependencies": {
54
- "@babel/preset-react": "7.16.0",
55
- "@emotion/jest": "11.5.0",
56
- "@lowdefy/block-dev": "4.0.0-alpha.1",
57
- "@swc/cli": "0.1.52",
58
- "@swc/core": "1.2.112",
59
- "@swc/jest": "0.2.9",
60
- "@testing-library/dom": "8.10.1",
60
+ "@emotion/jest": "11.7.1",
61
+ "@lowdefy/block-dev": "4.0.0-alpha.12",
62
+ "@swc/cli": "0.1.55",
63
+ "@swc/core": "1.2.135",
64
+ "@swc/jest": "0.2.17",
65
+ "@testing-library/dom": "8.11.3",
61
66
  "@testing-library/react": "13.0.0-alpha.4",
62
67
  "@testing-library/user-event": "14.0.0-alpha.14",
63
68
  "copyfiles": "2.4.1",
64
- "jest": "27.3.1",
69
+ "jest": "27.5.1",
65
70
  "jest-serializer-html": "7.1.0",
66
- "jest-transform-yaml": "0.1.2"
71
+ "jest-transform-yaml": "1.0.0"
67
72
  },
68
73
  "publishConfig": {
69
74
  "access": "public"
70
75
  },
71
- "gitHead": "c97a8fa6b5a641e7d50df09f5601a9c586eeb65a"
76
+ "gitHead": "41b6138a81bee7da362dad06345bc9f87b2c2133"
72
77
  }
@@ -1,15 +0,0 @@
1
- export default {
2
- import: {
3
- block: 'blocks/DangerousMarkdown/DangerousMarkdown.js',
4
- styles: []
5
- },
6
- meta: {
7
- category: 'container',
8
- loading: {
9
- type: 'SkeletonParagraph',
10
- properties: {
11
- lines: 7
12
- }
13
- }
14
- }
15
- };
@@ -1,15 +0,0 @@
1
- export default {
2
- import: {
3
- block: 'blocks/Markdown/Markdown.js',
4
- styles: []
5
- },
6
- meta: {
7
- category: 'container',
8
- loading: {
9
- type: 'SkeletonParagraph',
10
- properties: {
11
- lines: 7
12
- }
13
- }
14
- }
15
- };
@@ -1,15 +0,0 @@
1
- export default {
2
- import: {
3
- block: 'blocks/MarkdownWithCode/MarkdownWithCode.js',
4
- styles: []
5
- },
6
- meta: {
7
- category: 'container',
8
- loading: {
9
- type: 'SkeletonParagraph',
10
- properties: {
11
- lines: 7
12
- }
13
- }
14
- }
15
- };