@uiw/react-markdown-preview
Advanced tools
| declare module '@uiw/react-markdown-preview/common' { | ||
| import React from 'react'; | ||
| import { MarkdownPreviewProps, MarkdownPreviewRef } from '@uiw/react-markdown-preview/lib/Props'; | ||
| export * from '@uiw/react-markdown-preview/lib/Props'; | ||
| const _default: React.ForwardRefExoticComponent<MarkdownPreviewProps & React.RefAttributes<MarkdownPreviewRef>>; | ||
| export default _default; | ||
| } |
| import React from 'react'; | ||
| import type { MarkdownPreviewProps, MarkdownPreviewRef } from './Props'; | ||
| export * from './Props'; | ||
| declare const _default: React.ForwardRefExoticComponent<MarkdownPreviewProps & React.RefAttributes<MarkdownPreviewRef>>; | ||
| export default _default; |
| import _extends from "@babel/runtime/helpers/extends"; | ||
| import React from 'react'; | ||
| import rehypePrism from 'rehype-prism-plus/common'; | ||
| import rehypeRewrite from 'rehype-rewrite'; | ||
| import rehypeAttrs from 'rehype-attr'; | ||
| import rehypeRaw from 'rehype-raw'; | ||
| import MarkdownPreview from "./preview.js"; | ||
| import { reservedMeta } from "./plugins/reservedMeta.js"; | ||
| import { retrieveMeta } from "./plugins/retrieveMeta.js"; | ||
| import { rehypeRewriteHandle, defaultRehypePlugins } from "./rehypePlugins.js"; | ||
| import { jsx as _jsx } from "react/jsx-runtime"; | ||
| export * from "./Props.js"; | ||
| export default /*#__PURE__*/React.forwardRef((props, ref) => { | ||
| var _props$disableCopy; | ||
| var rehypePlugins = [reservedMeta, rehypeRaw, retrieveMeta, ...defaultRehypePlugins, [rehypeRewrite, { | ||
| rewrite: rehypeRewriteHandle((_props$disableCopy = props.disableCopy) != null ? _props$disableCopy : false, props.rehypeRewrite) | ||
| }], [rehypeAttrs, { | ||
| properties: 'attr' | ||
| }], ...(props.rehypePlugins || []), [rehypePrism, { | ||
| ignoreMissing: true | ||
| }]]; | ||
| return /*#__PURE__*/_jsx(MarkdownPreview, _extends({}, props, { | ||
| rehypePlugins: rehypePlugins, | ||
| ref: ref | ||
| })); | ||
| }); |
| import React from 'react'; | ||
| import type { MarkdownPreviewProps, MarkdownPreviewRef } from './Props'; | ||
| export * from './Props'; | ||
| declare const _default: React.ForwardRefExoticComponent<MarkdownPreviewProps & React.RefAttributes<MarkdownPreviewRef>>; | ||
| export default _default; |
| "use strict"; | ||
| var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"]; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| var _exportNames = {}; | ||
| exports["default"] = void 0; | ||
| var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
| var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
| var _react = _interopRequireDefault(require("react")); | ||
| var _common = _interopRequireDefault(require("rehype-prism-plus/common")); | ||
| var _rehypeRewrite = _interopRequireDefault(require("rehype-rewrite")); | ||
| var _rehypeAttr = _interopRequireDefault(require("rehype-attr")); | ||
| var _rehypeRaw = _interopRequireDefault(require("rehype-raw")); | ||
| var _preview = _interopRequireDefault(require("./preview")); | ||
| var _reservedMeta = require("./plugins/reservedMeta"); | ||
| var _retrieveMeta = require("./plugins/retrieveMeta"); | ||
| var _rehypePlugins = require("./rehypePlugins"); | ||
| var _jsxRuntime = require("react/jsx-runtime"); | ||
| var _Props = require("./Props"); | ||
| Object.keys(_Props).forEach(function (key) { | ||
| if (key === "default" || key === "__esModule") return; | ||
| if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
| if (key in exports && exports[key] === _Props[key]) return; | ||
| Object.defineProperty(exports, key, { | ||
| enumerable: true, | ||
| get: function get() { | ||
| return _Props[key]; | ||
| } | ||
| }); | ||
| }); | ||
| var _default = exports["default"] = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) { | ||
| var _props$disableCopy; | ||
| var rehypePlugins = [_reservedMeta.reservedMeta, _rehypeRaw["default"], _retrieveMeta.retrieveMeta].concat((0, _toConsumableArray2["default"])(_rehypePlugins.defaultRehypePlugins), [[_rehypeRewrite["default"], { | ||
| rewrite: (0, _rehypePlugins.rehypeRewriteHandle)((_props$disableCopy = props.disableCopy) !== null && _props$disableCopy !== void 0 ? _props$disableCopy : false, props.rehypeRewrite) | ||
| }], [_rehypeAttr["default"], { | ||
| properties: 'attr' | ||
| }]], (0, _toConsumableArray2["default"])(props.rehypePlugins || []), [[_common["default"], { | ||
| ignoreMissing: true | ||
| }]]); | ||
| return /*#__PURE__*/(0, _jsxRuntime.jsx)(_preview["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), {}, { | ||
| rehypePlugins: rehypePlugins, | ||
| ref: ref | ||
| })); | ||
| }); |
| import React from 'react'; | ||
| import rehypePrism from 'rehype-prism-plus/common'; | ||
| import type { PluggableList } from 'unified'; | ||
| import rehypeRewrite from 'rehype-rewrite'; | ||
| import rehypeAttrs from 'rehype-attr'; | ||
| import rehypeRaw from 'rehype-raw'; | ||
| import MarkdownPreview from './preview'; | ||
| import { reservedMeta } from './plugins/reservedMeta'; | ||
| import { retrieveMeta } from './plugins/retrieveMeta'; | ||
| import { rehypeRewriteHandle, defaultRehypePlugins } from './rehypePlugins'; | ||
| import type { MarkdownPreviewProps, MarkdownPreviewRef } from './Props'; | ||
| export * from './Props'; | ||
| export default React.forwardRef<MarkdownPreviewRef, MarkdownPreviewProps>((props, ref) => { | ||
| const rehypePlugins: PluggableList = [ | ||
| reservedMeta, | ||
| rehypeRaw, | ||
| retrieveMeta, | ||
| ...defaultRehypePlugins, | ||
| [rehypeRewrite, { rewrite: rehypeRewriteHandle(props.disableCopy ?? false, props.rehypeRewrite) }], | ||
| [rehypeAttrs, { properties: 'attr' }], | ||
| ...(props.rehypePlugins || []), | ||
| [rehypePrism, { ignoreMissing: true }], | ||
| ]; | ||
| return <MarkdownPreview {...props} rehypePlugins={rehypePlugins} ref={ref} />; | ||
| }); |
+7
-1
| { | ||
| "name": "@uiw/react-markdown-preview", | ||
| "version": "5.1.7", | ||
| "version": "5.2.0", | ||
| "description": "React component preview markdown text in web browser. The minimal amount of CSS to replicate the GitHub Markdown style.", | ||
@@ -18,2 +18,7 @@ "homepage": "https://uiwjs.github.io/react-markdown-preview", | ||
| }, | ||
| "./common": { | ||
| "import": "./esm/common.js", | ||
| "types": "./lib/common.d.ts", | ||
| "require": "./lib/common.js" | ||
| }, | ||
| "./nohighlight": { | ||
@@ -35,2 +40,3 @@ "import": "./esm/nohighlight.js", | ||
| "esm", | ||
| "common.d.ts", | ||
| "nohighlight.d.ts", | ||
@@ -37,0 +43,0 @@ "markdown.css", |
+23
-0
@@ -219,2 +219,25 @@ <div markdown="1"> | ||
| ## Common Code Highlight | ||
| Use `@uiw/react-markdown-preview/common` to keep syntax highlighting enabled with the `rehype-prism-plus/common` language subset. This is a middle ground between the default all-language build and `nohighlight`. | ||
| ```jsx mdx:preview | ||
| import React from 'react'; | ||
| import MarkdownPreview from '@uiw/react-markdown-preview/common'; | ||
| const source = ` | ||
| \`\`\`js | ||
| function greet(name) { | ||
| console.log('hello', name); | ||
| } | ||
| \`\`\` | ||
| `; | ||
| export default function Demo() { | ||
| return ( | ||
| <MarkdownPreview source={source} style={{ padding: 16 }} /> | ||
| ); | ||
| } | ||
| ``` | ||
| ## Remove Code Highlight | ||
@@ -221,0 +244,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
3691595
0.17%69
9.52%74977
0.15%798
2.97%