Skip to content

Commit d63253b

Browse files
committed
remove usage of old PluggableList type
1 parent 9e3f67f commit d63253b

3 files changed

Lines changed: 7 additions & 433 deletions

File tree

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@
7373
"@blueprintjs/select": "^5.3.19",
7474
"@carbon/icons": "^11.58.0",
7575
"@carbon/react": "^1.80.1",
76+
"@codemirror/lang-html": "^6.4.9",
7677
"@codemirror/lang-javascript": "^6.2.3",
7778
"@codemirror/lang-json": "^6.0.1",
7879
"@codemirror/lang-markdown": "^6.3.2",
7980
"@codemirror/lang-sql": "^6.8.0",
8081
"@codemirror/lang-xml": "^6.1.0",
8182
"@codemirror/lang-yaml": "^6.1.2",
82-
"@codemirror/lang-html": "^6.4.9",
8383
"@codemirror/legacy-modes": "^6.5.0",
8484
"@mavrin/remark-typograf": "^2.2.0",
8585
"@xyflow/react": "^12.6.0",
@@ -97,7 +97,6 @@
9797
"react-inlinesvg": "^3.0.3",
9898
"react-is": "^16.13.1",
9999
"react-markdown": "^10.1.0",
100-
"react-markdown-deprecated": "npm:react-markdown@^8.0.7",
101100
"react-syntax-highlighter": "^15.6.1",
102101
"rehype-external-links": "^3.0.0",
103102
"rehype-raw": "^7.0.0",

src/cmem/markdown/Markdown.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import React from "react";
22
import ReactMarkdown from "react-markdown";
3-
/**
4-
* Recreate the old type to provide support until next major
5-
*/
6-
import { PluggableList as PluggableListDeprecated } from "react-markdown-deprecated/lib/react-markdown";
73
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
84
// @ts-ignore: No declaration file for module (TODO: should be @ts-expect-error but GUI elements is used inside project with `noImplicitAny=false`)
95
import remarkTypograf from "@mavrin/remark-typograf";
106
import rehypeExternalLinks from "rehype-external-links";
117
import rehypeRaw from "rehype-raw";
128
import { remarkDefinitionList } from "remark-definition-list";
139
import remarkGfm from "remark-gfm";
14-
import { PluggableList as PluggableListUnified } from "unified";
10+
import { PluggableList } from "unified";
1511

1612
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1713
import { HtmlContentBlock, HtmlContentBlockProps, TestableComponent } from "../../index";
18-
type PluggableList = PluggableListUnified | PluggableListDeprecated;
1914

2015
export interface MarkdownProps extends TestableComponent {
2116
children: string;
@@ -41,7 +36,6 @@ export interface MarkdownProps extends TestableComponent {
4136
/**
4237
* Additional reHype plugins to execute.
4338
* @see https://github.com/remarkjs/react-markdown#architecture
44-
* @deprecated (v25) this property won't support `PluggableList` from "react-markdown/lib/react-markdown" with the next major version, only the one from `unified` will be supported then.
4539
*/
4640
reHypePlugins?: PluggableList;
4741
/**
@@ -61,9 +55,9 @@ const configDefault = {
6155
@see https://github.com/remarkjs/react-markdown#api
6256
*/
6357
// @see https://github.com/remarkjs/remark/blob/main/doc/plugins.md#list-of-plugins
64-
remarkPlugins: [remarkGfm, remarkTypograf, remarkDefinitionList] as PluggableListUnified,
58+
remarkPlugins: [remarkGfm, remarkTypograf, remarkDefinitionList] as PluggableList,
6559
// @see https://github.com/rehypejs/rehype/blob/main/doc/plugins.md#list-of-plugins
66-
rehypePlugins: [] as PluggableListUnified,
60+
rehypePlugins: [] as PluggableList,
6761
allowedElements: [
6862
// default markdown
6963
"a",
@@ -173,9 +167,7 @@ export const Markdown = ({
173167
};
174168

175169
if (reHypePlugins) {
176-
reactMarkdownProperties.rehypePlugins = reactMarkdownProperties.rehypePlugins.concat(
177-
reHypePlugins as PluggableListUnified
178-
);
170+
reactMarkdownProperties.rehypePlugins = reactMarkdownProperties.rehypePlugins.concat(reHypePlugins);
179171
}
180172

181173
const markdownDisplay = <ReactMarkdown {...reactMarkdownProperties} />;

0 commit comments

Comments
 (0)