
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
rehype-mdx-code-props
Advanced tools
A rehype MDX plugin for interpreting markdown code meta as props.
npm install rehype-mdx-code-props
This plugin interprets markdown code block metadata as JSX props.
For example, given a file named example.mdx with the following content:
```js copy filename="awesome.js" onOpen={props.openDemo} {...props}
console.log('Everything is awesome!')
```
The following script:
import { readFile } from 'node:fs/promises'
import { compile } from '@mdx-js/mdx'
import rehypeMdxCodeProps from 'rehype-mdx-code-props'
const { value } = await compile(await readFile('example.mdx'), {
jsx: true,
rehypePlugins: [rehypeMdxCodeProps]
})
console.log(value)
Roughly yields:
export default function MDXContent(props) {
return (
<pre copy filename="awesome.js" onOpen={props.openDemo} {...props}>
<code className="language-js">{"console.log('Everything is awesome!');\n"}</code>
</pre>
)
}
The <pre /> element doesn’t support those custom props. Use custom
components to give the props meaning.
Note This plugin transforms the
hast(HTML) nodes into JSX. After running this plugin, they can no longer be processed by other plugins. To combine it with other plugins, such as syntax highlighting plugins,rehype-mdx-code-propsmust run last.
This package has a default export rehypeMdxCodeProps.
rehypeMdxCodePropsAn MDX rehype plugin for transforming markdown code meta into JSX props.
elementAttributeNameCase ('html' | 'react'): The casing to use for attribute names. This
should match the elementAttributeNameCase value passed to MDX. (Default: 'react')tagName ('code' | 'pre'): The tag name to add the attributes to. (Default: 'pre')This plugin works with Node.js 16 or greater and MDX 3.
MIT © Remco Haszing
FAQs
A rehype MDX plugin for interpreting markdown code meta as props
The npm package rehype-mdx-code-props receives a total of 17,548 weekly downloads. As such, rehype-mdx-code-props popularity was classified as popular.
We found that rehype-mdx-code-props demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.