Skip to content

Commit 84e97cc

Browse files
Demos. fix version for rehype-parse
(for CodeSandbox compatibility)
1 parent e0639a5 commit 84e97cc

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • apps/demos/Demos/HtmlEditor/MarkdownSupport/Vue

apps/demos/Demos/HtmlEditor/MarkdownSupport/Vue/App.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
<script setup lang="ts">
4040
import { ref } from 'vue';
4141
import { unified } from "unified";
42+
import type { Plugin } from 'unified';
43+
4244
import remarkParse from "remark-parse";
4345
import remarkRehype from "remark-rehype";
4446
import remarkStringify from "remark-stringify";
@@ -52,6 +54,12 @@ import {
5254
} from 'devextreme-vue/html-editor';
5355
import { markup } from './data.ts';
5456
57+
// Plugin<[(Options | null | undefined)?], string, Root>
58+
// Plugin<[Options?] | Array<void>, string, Root>
59+
type RehypeParseType = typeof rehypeParse extends Plugin<[infer P], infer S, infer R>
60+
? Plugin<[(P | null | undefined)?], S, R>
61+
: never;
62+
5563
const valueContent = ref(markup);
5664
const headerValues = [false, 1, 2, 3, 4, 5];
5765
const headerOptions = { inputAttr: { 'aria-label': 'Header' } };
@@ -69,7 +77,7 @@ const converter = {
6977
},
7078
fromHtml(value) {
7179
const result = unified()
72-
.use(rehypeParse)
80+
.use(rehypeParse as RehypeParseType)
7381
.use(rehypeRemark)
7482
.use(remarkStringify)
7583
.processSync(value)

0 commit comments

Comments
 (0)