
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
rehype-playground
Advanced tools
Playground is a rehype plugin and React component that allows you to create rich and interactive code examples for your documentation or web application.
Playground was created to make it easier for developers to create and share interactive code examples in their documentation or web application. Traditional code snippets can be difficult to read and understand, especially for beginners, and often lack the context needed to fully comprehend the code.
Playground solves this problem by providing an interactive environment for code examples that allows users to edit, run, and explore the code in real-time. Users can experiment with different inputs and outputs, see the results of their changes, and even copy the code to use in their own projects.
Playground also provides error handling and device-specific formatting options, making it a versatile and reliable tool for developers of all skill levels.
By using Playground, developers can create more engaging and interactive documentation and web applications, which can improve the learning experience for their users and ultimately lead to better adoption and retention of their products and services.
The Playground component provides the following features:
To use Playground, you first need to install it as a dependency in your project:
npm install rehype-playground
To use Playground with Next.js, you'll need to add a next.config.mjs file to the root of your project with the following content:
const withMDX = require("@next/mdx")({
extension: /\.mdx?$/,
options: {
rehypePlugins: [require("rehype-playground/plugin")],
},
});
module.exports = withMDX();
This will configure Next.js to use Playground with MDX files in your project.
To use Playground with Remix, you'll need to add a mix.config.js file to the root of your project with the following content:
const mixMDX = require("@remix-run/mdx");
const rehypePlugins = [require("rehype-playground/plugin")];
module.exports = mixMDX.default({
rehypePlugins,
});
This will configure Remix to use Playground with MDX files in your project.
To use Playground with Astro, you'll need to add a astro.config.mjs file to the root of your project with the following content:
import { createPlugin } from "astro";
import rehype from "rehype";
import rehypePrism from "@mapbox/rehype-prism";
import playground from "rehype-playground/plugin";
export default {
plugins: [
createPlugin({
name: "rehype",
plugins: [playground, [rehypePrism, { ignoreMissing: true }], rehype()],
}),
],
};
This will configure Astro to use Playground with MDX files in your project.
To use Playground with Gatsby, you'll need to add a gatsby-config.js file to the root of your project with the following content:
module.exports = {
plugins: [
{
resolve: "gatsby-plugin-mdx",
options: {
gatsbyRemarkPlugins: [
{
resolve: "gatsby-remark-vscode",
options: {
theme: "Dark+ (default dark)",
extensions: ["theme-darcula"],
inlineCode: {
marker: ">",
},
},
},
],
remarkPlugins: [require("remark-slug")],
rehypePlugins: [require("rehype-playground/plugin")],
},
},
],
};
This will configure Gatsby to use Playground with MDX files in your project.
import Playground from 'rehype-playground';
import Button '...'
# Button
The `Button` component is a simple button that can be used in your application.
<Playground>
<Button>Click me</Button>
</Playground>

Playground is designed to work with MDX files and can be used in many React frameworks, including Next, Remix, Astro, and Gatsby. However, please note that Playground only works with ESM modules, and you may need to use the .mjs file extension in some configurations.
License
Playground is released under the MIT License. See LICENSE for more information.
FAQs

We found that rehype-playground demonstrated a not healthy version release cadence and project activity because the last version was released 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.