Skip to content

Commit

Permalink
fix: fix preview example. (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 21, 2023
1 parent 2eb9dc2 commit 92d9de6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/index.tsx
Expand Up @@ -12,8 +12,8 @@ export * from './preview';

export default React.forwardRef<MarkdownPreviewRef, MarkdownPreviewProps>((props, ref) => {
const rehypePlugins: PluggableList = [
rehypeRaw,
reservedMeta,
rehypeRaw,
[rehypePrism, { ignoreMissing: true }],
...defaultRehypePlugins,
[rehypeRewrite, { rewrite: rehypeRewriteHandle(props.disableCopy ?? false, props.rehypeRewrite) }],
Expand Down
2 changes: 1 addition & 1 deletion core/src/nohighlight.tsx
Expand Up @@ -9,8 +9,8 @@ import { rehypeRewriteHandle, defaultRehypePlugins } from './rehypePlugins';

export default React.forwardRef<MarkdownPreviewRef, MarkdownPreviewProps>((props, ref) => {
const rehypePlugins: PluggableList = [
rehypeRaw,
reservedMeta,
rehypeRaw,
...defaultRehypePlugins,
[rehypeRewrite, { rewrite: rehypeRewriteHandle(props.disableCopy ?? false, props.rehypeRewrite) }],
[rehypeAttrs, { properties: 'attr' }],
Expand Down
3 changes: 3 additions & 0 deletions core/src/plugins/reservedMeta.ts
Expand Up @@ -10,6 +10,9 @@ export const reservedMeta: Plugin<[ReservedMetaOptions?], Root> = (options = {})
if (node.type === 'element' && node.tagName === 'code' && node.properties && node.properties.meta) {
node.properties = { ...node.properties, 'data-meta': String(node.properties.meta) };
}
if (node.type === 'element' && node.tagName === 'code' && node.data && node.data.meta) {
node.properties = { ...node.properties, 'data-meta': String(node.data.meta) };
}
});
};
};
4 changes: 2 additions & 2 deletions website/package.json
Expand Up @@ -4,11 +4,11 @@
"private": true,
"scripts": {
"build": "kkt build",
"start": "kkt start",
"start": "GENERATE_SOURCEMAP=false kkt start",
"map": "source-map-explorer build/static/js/*.js --html build/website-result.html"
},
"dependencies": {
"@uiw/react-markdown-preview-example": "^1.5.5",
"@uiw/react-markdown-preview-example": "^1.5.9",
"@uiw/react-shields": "^2.0.1",
"mermaid": "^10.4.0",
"react": "~18.2.0",
Expand Down

0 comments on commit 92d9de6

Please sign in to comment.