@lowdefy/blocks-markdown 4.0.0-alpha.5 → 4.0.0-alpha.6
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.
|
@@ -18,6 +18,7 @@ import DOMPurify from 'dompurify';
|
|
|
18
18
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
19
19
|
import ReactMarkdown from 'react-markdown';
|
|
20
20
|
import gfm from 'remark-gfm';
|
|
21
|
+
import rehypeRaw from 'rehype-raw';
|
|
21
22
|
let DangerousMarkdown = class DangerousMarkdown extends React.Component {
|
|
22
23
|
render() {
|
|
23
24
|
const { blockId , properties , methods } = this.props;
|
|
@@ -26,10 +27,12 @@ let DangerousMarkdown = class DangerousMarkdown extends React.Component {
|
|
|
26
27
|
className: methods.makeCssClass(properties.style),
|
|
27
28
|
children: /*#__PURE__*/ _jsx(ReactMarkdown, {
|
|
28
29
|
className: "markdown-body",
|
|
29
|
-
|
|
30
|
+
remarkPlugins: [
|
|
30
31
|
gfm
|
|
31
32
|
],
|
|
32
|
-
|
|
33
|
+
rehypePlugins: [
|
|
34
|
+
rehypeRaw
|
|
35
|
+
],
|
|
33
36
|
skipHtml: false,
|
|
34
37
|
children: DOMPurify.sanitize(this.props.properties.content, this.DOMPurifyOptions)
|
|
35
38
|
})
|
|
@@ -49,7 +52,8 @@ DangerousMarkdown.meta = {
|
|
|
49
52
|
properties: {
|
|
50
53
|
lines: 7
|
|
51
54
|
}
|
|
52
|
-
}
|
|
55
|
+
},
|
|
56
|
+
icons: [],
|
|
57
|
+
styles: []
|
|
53
58
|
};
|
|
54
|
-
DangerousMarkdown.styles = [];
|
|
55
59
|
export default DangerousMarkdown;
|
|
@@ -22,10 +22,10 @@ const Markdown = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx("div"
|
|
|
22
22
|
className: methods.makeCssClass(properties.style),
|
|
23
23
|
children: /*#__PURE__*/ _jsx(ReactMarkdown, {
|
|
24
24
|
className: "markdown-body",
|
|
25
|
-
|
|
25
|
+
skipHtml: properties.skipHtml,
|
|
26
|
+
remarkPlugins: [
|
|
26
27
|
gfm
|
|
27
28
|
],
|
|
28
|
-
skipHtml: properties.skipHtml,
|
|
29
29
|
children: properties.content
|
|
30
30
|
})
|
|
31
31
|
})
|
|
@@ -38,7 +38,8 @@ Markdown.meta = {
|
|
|
38
38
|
properties: {
|
|
39
39
|
lines: 7
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
icons: [],
|
|
43
|
+
styles: []
|
|
42
44
|
};
|
|
43
|
-
Markdown.styles = [];
|
|
44
45
|
export default Markdown;
|
|
@@ -18,36 +18,37 @@ import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
|
18
18
|
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
19
19
|
import ReactMarkdown from 'react-markdown';
|
|
20
20
|
import gfm from 'remark-gfm';
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
SyntaxHighlighter.registerLanguage('
|
|
33
|
-
SyntaxHighlighter.registerLanguage('
|
|
34
|
-
SyntaxHighlighter.registerLanguage('
|
|
35
|
-
SyntaxHighlighter.registerLanguage('
|
|
36
|
-
SyntaxHighlighter.registerLanguage('
|
|
37
|
-
SyntaxHighlighter.registerLanguage('
|
|
38
|
-
SyntaxHighlighter.registerLanguage('
|
|
39
|
-
SyntaxHighlighter.registerLanguage('
|
|
40
|
-
SyntaxHighlighter.registerLanguage('
|
|
41
|
-
SyntaxHighlighter.registerLanguage('
|
|
42
|
-
SyntaxHighlighter.registerLanguage('
|
|
43
|
-
SyntaxHighlighter.registerLanguage('
|
|
44
|
-
SyntaxHighlighter.registerLanguage('
|
|
45
|
-
SyntaxHighlighter.registerLanguage('
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
// See https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/393 for esm issue.
|
|
22
|
+
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github.js';
|
|
23
|
+
import javascript from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript.js';
|
|
24
|
+
import typescript from 'react-syntax-highlighter/dist/cjs/languages/hljs/typescript.js';
|
|
25
|
+
import python from 'react-syntax-highlighter/dist/cjs/languages/hljs/python.js';
|
|
26
|
+
import java from 'react-syntax-highlighter/dist/cjs/languages/hljs/java.js';
|
|
27
|
+
import xml from 'react-syntax-highlighter/dist/cjs/languages/hljs/xml.js';
|
|
28
|
+
import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json.js';
|
|
29
|
+
import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml.js';
|
|
30
|
+
import markdown from 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown.js';
|
|
31
|
+
import handlebars from 'react-syntax-highlighter/dist/cjs/languages/hljs/handlebars.js';
|
|
32
|
+
SyntaxHighlighter.registerLanguage('handlebars', handlebars.default);
|
|
33
|
+
SyntaxHighlighter.registerLanguage('nunjucks', handlebars.default);
|
|
34
|
+
SyntaxHighlighter.registerLanguage('html', handlebars.default);
|
|
35
|
+
SyntaxHighlighter.registerLanguage('java', java.default);
|
|
36
|
+
SyntaxHighlighter.registerLanguage('javascript', javascript.default);
|
|
37
|
+
SyntaxHighlighter.registerLanguage('js', javascript.default);
|
|
38
|
+
SyntaxHighlighter.registerLanguage('jsx', javascript.default);
|
|
39
|
+
SyntaxHighlighter.registerLanguage('json', json.default);
|
|
40
|
+
SyntaxHighlighter.registerLanguage('markdown', markdown.default);
|
|
41
|
+
SyntaxHighlighter.registerLanguage('python', python.default);
|
|
42
|
+
SyntaxHighlighter.registerLanguage('py', python.default);
|
|
43
|
+
SyntaxHighlighter.registerLanguage('typescript', typescript.default);
|
|
44
|
+
SyntaxHighlighter.registerLanguage('ts', typescript.default);
|
|
45
|
+
SyntaxHighlighter.registerLanguage('xml', xml.default);
|
|
46
|
+
SyntaxHighlighter.registerLanguage('yaml', yaml.default);
|
|
47
|
+
const components = {
|
|
48
|
+
code: ({ language , children })=>/*#__PURE__*/ _jsx(SyntaxHighlighter, {
|
|
48
49
|
style: github,
|
|
49
50
|
language: language,
|
|
50
|
-
children:
|
|
51
|
+
children: children
|
|
51
52
|
})
|
|
52
53
|
};
|
|
53
54
|
const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx("div", {
|
|
@@ -55,11 +56,11 @@ const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ _j
|
|
|
55
56
|
className: methods.makeCssClass(properties.style),
|
|
56
57
|
children: /*#__PURE__*/ _jsx(ReactMarkdown, {
|
|
57
58
|
className: "markdown-body",
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
skipHtml: properties.skipHtml,
|
|
60
|
+
remarkPlugins: [
|
|
60
61
|
gfm
|
|
61
62
|
],
|
|
62
|
-
|
|
63
|
+
components: components,
|
|
63
64
|
children: properties.content
|
|
64
65
|
})
|
|
65
66
|
})
|
|
@@ -72,7 +73,8 @@ MarkdownWithCode.meta = {
|
|
|
72
73
|
properties: {
|
|
73
74
|
lines: 7
|
|
74
75
|
}
|
|
75
|
-
}
|
|
76
|
+
},
|
|
77
|
+
icons: [],
|
|
78
|
+
styles: []
|
|
76
79
|
};
|
|
77
|
-
MarkdownWithCode.styles = [];
|
|
78
80
|
export default MarkdownWithCode;
|
package/dist/types.js
CHANGED
|
@@ -13,13 +13,15 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import * as blocks from './blocks.js';
|
|
16
|
-
const
|
|
17
|
-
};
|
|
16
|
+
const icons = {};
|
|
17
|
+
const styles = {};
|
|
18
18
|
Object.keys(blocks).forEach((block)=>{
|
|
19
|
-
|
|
19
|
+
icons[block] = blocks[block].meta.icons || [];
|
|
20
|
+
styles[block] = blocks[block].meta.styles || [];
|
|
20
21
|
});
|
|
21
22
|
export default {
|
|
22
23
|
blocks: Object.keys(blocks),
|
|
24
|
+
icons,
|
|
23
25
|
styles: {
|
|
24
26
|
default: [
|
|
25
27
|
'style.less'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/blocks-markdown",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy markdown blocks.",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -46,21 +46,22 @@
|
|
|
46
46
|
"test": "jest --coverage"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lowdefy/block-utils": "4.0.0-alpha.
|
|
49
|
+
"@lowdefy/block-utils": "4.0.0-alpha.6",
|
|
50
50
|
"dompurify": "2.3.3",
|
|
51
51
|
"react": "18.0.0-alpha-327d5c484-20211106",
|
|
52
52
|
"react-dom": "18.0.0-alpha-327d5c484-20211106",
|
|
53
|
-
"react-markdown": "
|
|
54
|
-
"react-syntax-highlighter": "15.4.
|
|
55
|
-
"
|
|
53
|
+
"react-markdown": "7.1.1",
|
|
54
|
+
"react-syntax-highlighter": "15.4.5",
|
|
55
|
+
"rehype-raw": "6.1.0",
|
|
56
|
+
"remark-gfm": "3.0.1"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@babel/preset-react": "7.16.0",
|
|
59
60
|
"@emotion/jest": "11.5.0",
|
|
60
|
-
"@lowdefy/block-dev": "4.0.0-alpha.
|
|
61
|
-
"@swc/cli": "0.1.
|
|
62
|
-
"@swc/core": "1.2.
|
|
63
|
-
"@swc/jest": "0.2.
|
|
61
|
+
"@lowdefy/block-dev": "4.0.0-alpha.6",
|
|
62
|
+
"@swc/cli": "0.1.55",
|
|
63
|
+
"@swc/core": "1.2.130",
|
|
64
|
+
"@swc/jest": "0.2.17",
|
|
64
65
|
"@testing-library/dom": "8.10.1",
|
|
65
66
|
"@testing-library/react": "13.0.0-alpha.4",
|
|
66
67
|
"@testing-library/user-event": "14.0.0-alpha.14",
|
|
@@ -72,5 +73,5 @@
|
|
|
72
73
|
"publishConfig": {
|
|
73
74
|
"access": "public"
|
|
74
75
|
},
|
|
75
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "2530e31af795b6a3c75ac8f72c8dbe0ab5d1251b"
|
|
76
77
|
}
|