Skip to content

Commit 92d9de6

Browse files
committed
fix: fix preview example. (#248)
1 parent 2eb9dc2 commit 92d9de6

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

core/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export * from './preview';
1212

1313
export default React.forwardRef<MarkdownPreviewRef, MarkdownPreviewProps>((props, ref) => {
1414
const rehypePlugins: PluggableList = [
15-
rehypeRaw,
1615
reservedMeta,
16+
rehypeRaw,
1717
[rehypePrism, { ignoreMissing: true }],
1818
...defaultRehypePlugins,
1919
[rehypeRewrite, { rewrite: rehypeRewriteHandle(props.disableCopy ?? false, props.rehypeRewrite) }],

core/src/nohighlight.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { rehypeRewriteHandle, defaultRehypePlugins } from './rehypePlugins';
99

1010
export default React.forwardRef<MarkdownPreviewRef, MarkdownPreviewProps>((props, ref) => {
1111
const rehypePlugins: PluggableList = [
12-
rehypeRaw,
1312
reservedMeta,
13+
rehypeRaw,
1414
...defaultRehypePlugins,
1515
[rehypeRewrite, { rewrite: rehypeRewriteHandle(props.disableCopy ?? false, props.rehypeRewrite) }],
1616
[rehypeAttrs, { properties: 'attr' }],

core/src/plugins/reservedMeta.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export const reservedMeta: Plugin<[ReservedMetaOptions?], Root> = (options = {})
1010
if (node.type === 'element' && node.tagName === 'code' && node.properties && node.properties.meta) {
1111
node.properties = { ...node.properties, 'data-meta': String(node.properties.meta) };
1212
}
13+
if (node.type === 'element' && node.tagName === 'code' && node.data && node.data.meta) {
14+
node.properties = { ...node.properties, 'data-meta': String(node.data.meta) };
15+
}
1316
});
1417
};
1518
};

website/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"private": true,
55
"scripts": {
66
"build": "kkt build",
7-
"start": "kkt start",
7+
"start": "GENERATE_SOURCEMAP=false kkt start",
88
"map": "source-map-explorer build/static/js/*.js --html build/website-result.html"
99
},
1010
"dependencies": {
11-
"@uiw/react-markdown-preview-example": "^1.5.5",
11+
"@uiw/react-markdown-preview-example": "^1.5.9",
1212
"@uiw/react-shields": "^2.0.1",
1313
"mermaid": "^10.4.0",
1414
"react": "~18.2.0",

0 commit comments

Comments
 (0)