
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@jinjiang-dev/vite-plugin-mdx
Advanced tools
====================== WE ARE LOOKING FOR A NEW MAINTAINER ====================
Use this Vite plugin to use MDX v1 with your Vite v2 app. For Vite v3+ we recommend migrating to MDX v2 using the official @mdx-js/rollup
, this comment explains how to implement it.
Features:
Install:
npm install vite-plugin-mdx
npm install @mdx-js/mdx
npm install @mdx-js/react
Or MDX Preact:
npm install @mdx-js/preact
Add the plugin to your vite.config.js
.
// vite.config.js
import mdx from 'vite-plugin-mdx'
// `options` are passed to `@mdx-js/mdx`
const options = {
// See https://mdxjs.com/advanced/plugins
remarkPlugins: [
// E.g. `remark-frontmatter`
],
rehypePlugins: [],
}
export default {
plugins: [mdx(options)]
}
You can now write .mdx
files.
// hello.mdx
import { Counter } from './Counter.jsx'
# Hello
This text is written in Markdown.
MDX allows Rich React components to be used directly in Markdown: <Counter/>
// Counter.jsx
import React, { useState } from 'react'
export { Counter }
function Counter() {
const [count, setCount] = useState(0)
return (
<button onClick={() => setCount((count) => count + 1)}>
Counter: {count}
</button>
)
}
To define options a per-file basis, you can pass a function to the mdx
plugin factory.
mdx((filename) => {
// Any options passed to `mdx` can be returned.
return {
remarkPlugins: [
// Enable a plugin based on the current file.
/\/components\//.test(filename) && someRemarkPlugin,
]
}
})
To embed an .mdx
or .md
file into another, you can import it without naming its export. The file extension is required. Remark plugins are applied to the imported file before it's embedded.
import '../foo/bar.mdx'
FAQs
Vite plugin for MDX
We found that @jinjiang-dev/vite-plugin-mdx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.