@ndla/article-converter 9.0.13-alpha.0 → 9.0.14-alpha.0
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.
- package/es/plugins/blockquotePlugin.js +18 -0
- package/es/plugins/{ddPlugin.js → detailsPlugin.js} +4 -5
- package/es/plugins/divPlugin.js +2 -1
- package/es/plugins/{dtPlugin.js → dlPlugin.js} +3 -3
- package/es/plugins/embed/conceptEmbedPlugin.js +0 -1
- package/es/plugins/index.js +9 -5
- package/es/plugins/summaryPlugin.js +18 -0
- package/es/plugins/tablePlugin.js +1 -1
- package/lib/plugins/blockquotePlugin.d.ts +9 -0
- package/lib/plugins/blockquotePlugin.js +25 -0
- package/lib/plugins/{ddPlugin.d.ts → detailsPlugin.d.ts} +2 -2
- package/lib/plugins/{ddPlugin.js → detailsPlugin.js} +6 -7
- package/lib/plugins/divPlugin.js +2 -1
- package/lib/plugins/{dtPlugin.d.ts → dlPlugin.d.ts} +1 -1
- package/lib/plugins/{dtPlugin.js → dlPlugin.js} +5 -5
- package/lib/plugins/embed/conceptEmbedPlugin.js +0 -1
- package/lib/plugins/index.js +9 -5
- package/lib/plugins/summaryPlugin.d.ts +9 -0
- package/lib/plugins/summaryPlugin.js +25 -0
- package/lib/plugins/tablePlugin.js +2 -2
- package/package.json +4 -3
- package/src/plugins/blockquotePlugin.tsx +16 -0
- package/src/plugins/detailsPlugin.tsx +17 -0
- package/src/plugins/divPlugin.tsx +2 -1
- package/src/plugins/{dtPlugin.tsx → dlPlugin.tsx} +4 -4
- package/src/plugins/embed/conceptEmbedPlugin.tsx +1 -1
- package/src/plugins/index.ts +8 -4
- package/src/plugins/{ddPlugin.tsx → summaryPlugin.tsx} +4 -6
- package/src/plugins/tablePlugin.tsx +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
+
import { BlockQuote } from "@ndla/primitives";
|
|
11
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
|
+
export const blockquotePlugin = (node, opts) => {
|
|
13
|
+
const props = attributesToProps(node.attribs);
|
|
14
|
+
return _jsx(BlockQuote, {
|
|
15
|
+
...props,
|
|
16
|
+
children: domToReact(node.children, opts)
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import {
|
|
10
|
+
import { ExpandableBox } from "@ndla/primitives";
|
|
11
11
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
|
-
export const
|
|
12
|
+
export const detailsPlugin = (node, converterOpts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(
|
|
14
|
+
return _jsx(ExpandableBox, {
|
|
15
15
|
...props,
|
|
16
|
-
lang: opts.articleLanguage,
|
|
17
16
|
children: domToReact(node.children, converterOpts)
|
|
18
17
|
});
|
|
19
18
|
};
|
package/es/plugins/divPlugin.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { domToReact, attributesToProps } from "html-react-parser";
|
|
10
|
-
import {
|
|
10
|
+
import { FramedContent } from "@ndla/primitives";
|
|
11
|
+
import { FileList, RelatedArticleList, Grid, GridParallaxItem } from "@ndla/ui";
|
|
11
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
12
13
|
export const divPlugin = (node, opts) => {
|
|
13
14
|
if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import {
|
|
10
|
+
import { DefinitionList } from "@ndla/primitives";
|
|
11
11
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
|
-
export const
|
|
12
|
+
export const dlPlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
14
|
-
return _jsx(
|
|
14
|
+
return _jsx(DefinitionList, {
|
|
15
15
|
...props,
|
|
16
16
|
lang: opts.articleLanguage,
|
|
17
17
|
children: domToReact(node.children, converterOpts)
|
package/es/plugins/index.js
CHANGED
|
@@ -8,16 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
import { anchorPlugin } from "./anchorPlugin";
|
|
10
10
|
import { asidePlugin } from "./asidePlugin";
|
|
11
|
+
import { blockquotePlugin } from "./blockquotePlugin";
|
|
11
12
|
import { copyParagraphPlugin } from "./copyParagraphPlugin";
|
|
12
|
-
import {
|
|
13
|
+
import { detailsPlugin } from "./detailsPlugin";
|
|
13
14
|
import { divPlugin } from "./divPlugin";
|
|
14
|
-
import {
|
|
15
|
+
import { dlPlugin } from "./dlPlugin";
|
|
15
16
|
import { h3Plugin } from "./h3Plugin";
|
|
16
17
|
import { mathPlugin } from "./mathPlugin";
|
|
17
18
|
import { navPlugin } from "./navPlugin";
|
|
18
19
|
import { anchorPlugin as oembedAnchorPlugin } from "./oembed/anchorPlugin";
|
|
19
20
|
import { olPlugin } from "./olPlugin";
|
|
20
21
|
import { paragraphPlugin } from "./paragraphPlugin";
|
|
22
|
+
import { summaryPlugin } from "./summaryPlugin";
|
|
21
23
|
import { tablePlugin } from "./tablePlugin";
|
|
22
24
|
import { ulPlugin } from "./ulPlugin";
|
|
23
25
|
export const basePlugins = {
|
|
@@ -30,10 +32,12 @@ export const basePlugins = {
|
|
|
30
32
|
table: tablePlugin,
|
|
31
33
|
aside: asidePlugin,
|
|
32
34
|
ul: ulPlugin,
|
|
33
|
-
dd: ddPlugin,
|
|
34
|
-
dt: dtPlugin,
|
|
35
35
|
nav: navPlugin,
|
|
36
|
-
a: anchorPlugin
|
|
36
|
+
a: anchorPlugin,
|
|
37
|
+
summary: summaryPlugin,
|
|
38
|
+
details: detailsPlugin,
|
|
39
|
+
dl: dlPlugin,
|
|
40
|
+
blockquote: blockquotePlugin
|
|
37
41
|
};
|
|
38
42
|
export const oembedPlugins = {
|
|
39
43
|
...basePlugins,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
+
import { ExpandableBoxSummary } from "@ndla/primitives";
|
|
11
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
|
+
export const summaryPlugin = (node, converterOpts) => {
|
|
13
|
+
const props = attributesToProps(node.attribs);
|
|
14
|
+
return _jsx(ExpandableBoxSummary, {
|
|
15
|
+
...props,
|
|
16
|
+
children: domToReact(node.children, converterOpts)
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import { Table } from "@ndla/
|
|
10
|
+
import { Table } from "@ndla/primitives";
|
|
11
11
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
12
12
|
export const tablePlugin = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { PluginType } from "./types";
|
|
9
|
+
export declare const blockquotePlugin: PluginType;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.blockquotePlugin = void 0;
|
|
7
|
+
var _htmlReactParser = require("html-react-parser");
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2024-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const blockquotePlugin = (node, opts) => {
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
+
return (0, _jsxRuntime.jsx)(_primitives.BlockQuote, {
|
|
21
|
+
...props,
|
|
22
|
+
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.blockquotePlugin = blockquotePlugin;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { PluginType } from "./types";
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const detailsPlugin: PluginType;
|
|
@@ -3,24 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.detailsPlugin = void 0;
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
|
-
var
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
10
|
/**
|
|
11
|
-
* Copyright (c)
|
|
11
|
+
* Copyright (c) 2024-present, NDLA.
|
|
12
12
|
*
|
|
13
13
|
* This source code is licensed under the GPLv3 license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const detailsPlugin = (node, converterOpts) => {
|
|
19
19
|
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
-
return (0, _jsxRuntime.jsx)(
|
|
20
|
+
return (0, _jsxRuntime.jsx)(_primitives.ExpandableBox, {
|
|
21
21
|
...props,
|
|
22
|
-
lang: opts.articleLanguage,
|
|
23
22
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
24
23
|
});
|
|
25
24
|
};
|
|
26
|
-
exports.
|
|
25
|
+
exports.detailsPlugin = detailsPlugin;
|
package/lib/plugins/divPlugin.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.divPlugin = void 0;
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
8
9
|
var _ui = require("@ndla/ui");
|
|
9
10
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
11
|
/**
|
|
@@ -17,7 +18,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
17
18
|
|
|
18
19
|
const divPlugin = (node, opts) => {
|
|
19
20
|
if (node.attribs["data-type"] === "framed-content" || node.attribs.class === "c-bodybox") {
|
|
20
|
-
return (0, _jsxRuntime.jsx)(
|
|
21
|
+
return (0, _jsxRuntime.jsx)(_primitives.FramedContent, {
|
|
21
22
|
children: (0, _htmlReactParser.domToReact)(node.children, opts)
|
|
22
23
|
});
|
|
23
24
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.dlPlugin = void 0;
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
|
-
var
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
10
|
/**
|
|
11
11
|
* Copyright (c) 2023-present, NDLA.
|
|
@@ -15,12 +15,12 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const dlPlugin = (node, converterOpts, opts) => {
|
|
19
19
|
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
-
return (0, _jsxRuntime.jsx)(
|
|
20
|
+
return (0, _jsxRuntime.jsx)(_primitives.DefinitionList, {
|
|
21
21
|
...props,
|
|
22
22
|
lang: opts.articleLanguage,
|
|
23
23
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
exports.
|
|
26
|
+
exports.dlPlugin = dlPlugin;
|
package/lib/plugins/index.js
CHANGED
|
@@ -6,16 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.oembedPlugins = exports.basePlugins = void 0;
|
|
7
7
|
var _anchorPlugin = require("./anchorPlugin");
|
|
8
8
|
var _asidePlugin = require("./asidePlugin");
|
|
9
|
+
var _blockquotePlugin = require("./blockquotePlugin");
|
|
9
10
|
var _copyParagraphPlugin = require("./copyParagraphPlugin");
|
|
10
|
-
var
|
|
11
|
+
var _detailsPlugin = require("./detailsPlugin");
|
|
11
12
|
var _divPlugin = require("./divPlugin");
|
|
12
|
-
var
|
|
13
|
+
var _dlPlugin = require("./dlPlugin");
|
|
13
14
|
var _h3Plugin = require("./h3Plugin");
|
|
14
15
|
var _mathPlugin = require("./mathPlugin");
|
|
15
16
|
var _navPlugin = require("./navPlugin");
|
|
16
17
|
var _anchorPlugin2 = require("./oembed/anchorPlugin");
|
|
17
18
|
var _olPlugin = require("./olPlugin");
|
|
18
19
|
var _paragraphPlugin = require("./paragraphPlugin");
|
|
20
|
+
var _summaryPlugin = require("./summaryPlugin");
|
|
19
21
|
var _tablePlugin = require("./tablePlugin");
|
|
20
22
|
var _ulPlugin = require("./ulPlugin");
|
|
21
23
|
/**
|
|
@@ -36,10 +38,12 @@ const basePlugins = exports.basePlugins = {
|
|
|
36
38
|
table: _tablePlugin.tablePlugin,
|
|
37
39
|
aside: _asidePlugin.asidePlugin,
|
|
38
40
|
ul: _ulPlugin.ulPlugin,
|
|
39
|
-
dd: _ddPlugin.ddPlugin,
|
|
40
|
-
dt: _dtPlugin.dtPlugin,
|
|
41
41
|
nav: _navPlugin.navPlugin,
|
|
42
|
-
a: _anchorPlugin.anchorPlugin
|
|
42
|
+
a: _anchorPlugin.anchorPlugin,
|
|
43
|
+
summary: _summaryPlugin.summaryPlugin,
|
|
44
|
+
details: _detailsPlugin.detailsPlugin,
|
|
45
|
+
dl: _dlPlugin.dlPlugin,
|
|
46
|
+
blockquote: _blockquotePlugin.blockquotePlugin
|
|
43
47
|
};
|
|
44
48
|
const oembedPlugins = exports.oembedPlugins = {
|
|
45
49
|
...basePlugins,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { PluginType } from "./types";
|
|
9
|
+
export declare const summaryPlugin: PluginType;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.summaryPlugin = void 0;
|
|
7
|
+
var _htmlReactParser = require("html-react-parser");
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Copyright (c) 2024-present, NDLA.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const summaryPlugin = (node, converterOpts) => {
|
|
19
|
+
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
+
return (0, _jsxRuntime.jsx)(_primitives.ExpandableBoxSummary, {
|
|
21
|
+
...props,
|
|
22
|
+
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.summaryPlugin = summaryPlugin;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.tablePlugin = void 0;
|
|
7
7
|
var _htmlReactParser = require("html-react-parser");
|
|
8
|
-
var
|
|
8
|
+
var _primitives = require("@ndla/primitives");
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
10
|
/**
|
|
11
11
|
* Copyright (c) 2023-present, NDLA.
|
|
@@ -17,7 +17,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
17
17
|
|
|
18
18
|
const tablePlugin = (node, converterOpts, opts) => {
|
|
19
19
|
const props = (0, _htmlReactParser.attributesToProps)(node.attribs);
|
|
20
|
-
return (0, _jsxRuntime.jsx)(
|
|
20
|
+
return (0, _jsxRuntime.jsx)(_primitives.Table, {
|
|
21
21
|
...props,
|
|
22
22
|
lang: opts.articleLanguage,
|
|
23
23
|
children: (0, _htmlReactParser.domToReact)(node.children, converterOpts)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/article-converter",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.14-alpha.0",
|
|
4
4
|
"description": "Transforms NDLA articles into extended html versions",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"@ndla/types-embed": "^4.1.8"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/
|
|
34
|
+
"@ndla/primitives": "^0.0.18",
|
|
35
|
+
"@ndla/ui": "^55.0.14-alpha.0",
|
|
35
36
|
"html-react-parser": "^5.1.8"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
@@ -46,5 +47,5 @@
|
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public"
|
|
48
49
|
},
|
|
49
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "6fdfbed9f18bbd725c837fb74de2f093e80d5605"
|
|
50
51
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
+
import { BlockQuote } from "@ndla/primitives";
|
|
11
|
+
import { PluginType } from "./types";
|
|
12
|
+
|
|
13
|
+
export const blockquotePlugin: PluginType = (node, opts) => {
|
|
14
|
+
const props = attributesToProps(node.attribs);
|
|
15
|
+
return <BlockQuote {...props}>{domToReact(node.children as DOMNode[], opts)}</BlockQuote>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
+
import { ExpandableBox } from "@ndla/primitives";
|
|
11
|
+
import { PluginType } from "./types";
|
|
12
|
+
|
|
13
|
+
export const detailsPlugin: PluginType = (node, converterOpts) => {
|
|
14
|
+
const props = attributesToProps(node.attribs);
|
|
15
|
+
|
|
16
|
+
return <ExpandableBox {...props}>{domToReact(node.children as DOMNode[], converterOpts)}</ExpandableBox>;
|
|
17
|
+
};
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { domToReact, attributesToProps, Element, DOMNode } from "html-react-parser";
|
|
10
|
-
import {
|
|
10
|
+
import { FramedContent } from "@ndla/primitives";
|
|
11
|
+
import { FileList, RelatedArticleList, Grid, GridType, GridParallaxItem } from "@ndla/ui";
|
|
11
12
|
import { PluginType } from "./types";
|
|
12
13
|
|
|
13
14
|
export const divPlugin: PluginType = (node, opts) => {
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import {
|
|
10
|
+
import { DefinitionList } from "@ndla/primitives";
|
|
11
11
|
import { PluginType } from "./types";
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const dlPlugin: PluginType = (node, converterOpts, opts) => {
|
|
14
14
|
const props = attributesToProps(node.attribs);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
17
|
+
<DefinitionList {...props} lang={opts.articleLanguage}>
|
|
18
18
|
{domToReact(node.children as DOMNode[], converterOpts)}
|
|
19
|
-
</
|
|
19
|
+
</DefinitionList>
|
|
20
20
|
);
|
|
21
21
|
};
|
|
@@ -14,5 +14,5 @@ import { PluginType } from "../types";
|
|
|
14
14
|
export const conceptEmbedPlugin: PluginType = (element, _, opts) => {
|
|
15
15
|
const props = attributesToProps(element.attribs);
|
|
16
16
|
const data = JSON.parse(props["data-json"] as string) as ConceptMetaData;
|
|
17
|
-
return <ConceptEmbed embed={data}
|
|
17
|
+
return <ConceptEmbed embed={data} lang={opts.articleLanguage} renderContext={opts.renderContext} />;
|
|
18
18
|
};
|
package/src/plugins/index.ts
CHANGED
|
@@ -8,16 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
import { anchorPlugin } from "./anchorPlugin";
|
|
10
10
|
import { asidePlugin } from "./asidePlugin";
|
|
11
|
+
import { blockquotePlugin } from "./blockquotePlugin";
|
|
11
12
|
import { copyParagraphPlugin } from "./copyParagraphPlugin";
|
|
12
|
-
import {
|
|
13
|
+
import { detailsPlugin } from "./detailsPlugin";
|
|
13
14
|
import { divPlugin } from "./divPlugin";
|
|
14
|
-
import {
|
|
15
|
+
import { dlPlugin } from "./dlPlugin";
|
|
15
16
|
import { h3Plugin } from "./h3Plugin";
|
|
16
17
|
import { mathPlugin } from "./mathPlugin";
|
|
17
18
|
import { navPlugin } from "./navPlugin";
|
|
18
19
|
import { anchorPlugin as oembedAnchorPlugin } from "./oembed/anchorPlugin";
|
|
19
20
|
import { olPlugin } from "./olPlugin";
|
|
20
21
|
import { paragraphPlugin } from "./paragraphPlugin";
|
|
22
|
+
import { summaryPlugin } from "./summaryPlugin";
|
|
21
23
|
import { tablePlugin } from "./tablePlugin";
|
|
22
24
|
import { PluginType } from "./types";
|
|
23
25
|
import { ulPlugin } from "./ulPlugin";
|
|
@@ -32,10 +34,12 @@ export const basePlugins: Record<string, PluginType> = {
|
|
|
32
34
|
table: tablePlugin,
|
|
33
35
|
aside: asidePlugin,
|
|
34
36
|
ul: ulPlugin,
|
|
35
|
-
dd: ddPlugin,
|
|
36
|
-
dt: dtPlugin,
|
|
37
37
|
nav: navPlugin,
|
|
38
38
|
a: anchorPlugin,
|
|
39
|
+
summary: summaryPlugin,
|
|
40
|
+
details: detailsPlugin,
|
|
41
|
+
dl: dlPlugin,
|
|
42
|
+
blockquote: blockquotePlugin,
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
export const oembedPlugins: Record<string, PluginType> = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -7,15 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import {
|
|
10
|
+
import { ExpandableBoxSummary } from "@ndla/primitives";
|
|
11
11
|
import { PluginType } from "./types";
|
|
12
12
|
|
|
13
|
-
export const
|
|
13
|
+
export const summaryPlugin: PluginType = (node, converterOpts) => {
|
|
14
14
|
const props = attributesToProps(node.attribs);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
18
|
-
{domToReact(node.children as DOMNode[], converterOpts)}
|
|
19
|
-
</DefinitionDescription>
|
|
17
|
+
<ExpandableBoxSummary {...props}>{domToReact(node.children as DOMNode[], converterOpts)}</ExpandableBoxSummary>
|
|
20
18
|
);
|
|
21
19
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { DOMNode, attributesToProps, domToReact } from "html-react-parser";
|
|
10
|
-
import { Table } from "@ndla/
|
|
10
|
+
import { Table } from "@ndla/primitives";
|
|
11
11
|
import { PluginType } from "./types";
|
|
12
12
|
export const tablePlugin: PluginType = (node, converterOpts, opts) => {
|
|
13
13
|
const props = attributesToProps(node.attribs);
|