npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mdx-deck-live-code

v1.0.1

Published

A component for mdx-deck for live coding directly in your slides. 🤯

Readme

mdx-deck-live-code 🤯 reinhold.is/live-coding-in-slides

A component for mdx-deck for live coding directly in your slides. 🤯

Build Status Version Dependency Status

npm install --save-dev mdx-deck-live-code

Follow @DrReinhold for updates

⚠️ This library is ONLY intended to work with your mdx-deck slides. It doesn't magically add live coding abilities to your PowerPoint or Keynote slides, even though that would be pretty slick.

🎭 Check out a live demo here

The code for demo is located in the /example directory.

🐣 Getting started

Import the LiveCode component at the top of your deck.mdx file (or in a slide if you're only using it once).

import { LiveCode } from 'mdx-deck-live-code';

Use the <LiveCode /> component as a top-level component in a slide

---
<LiveCode
  title="How to greet people"
  size="small"
  code="<p>Hello World!</p>"
/>
---

🐓 Usage

The <LiveCode /> is intended to be used as its own slide. It supports the following props:

| Prop | Type | Default | Description | | ------------- | ------------------------------------------------------ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | code | string | | The initial code that is pre-filled in the editor and preview. See Importing code from external files on advanced usage. | | title | string | | Title of the slide, shown in the top. Is not shown if size is set to fullscreen | | size | 'small' | 'medium' | 'large' | 'fullscreen' | 'medium' | The size of the live code component, relative to the viewport size. | | errors | boolean | true | Whether the error panel at the bottom should be shown or not on parse errors | | providerProps | object | | Any additional props to pass to the <LiveProvider /> component | | editorProps | object | | Any additional props to pass to the <LiveEditor /> component | | previewProps | object | | Any additional props to pass to the <LivePreview /> component | | errorProps | object | | Any additional props to pass to the <LiveError /> component |

Under the hood this <LiveCode /> uses react-live, So if you want to get super fancy, take a look at the react-live API.

See the example deck.mdx for examples on using the different features.

⤴ Importing code from external files

Your deck.mdx file can become quite a mess if you intend to have large chunks of code in your code props. Luckily the raw-loader library is supported out-of-the-box, so you can declare the code in external files, instead of writing it as an inline string.

To do that, first install the raw-loader package.

npm install --save-dev raw-loader

Then, in the code prop, reference another file using the require('!raw-loader!PATH-TO-FILE')-syntax.

<LiveCode code={require('!raw-loader!./external-file.js')} />

⚠️ Current issues

  • Editing the code currently doesn't sync between the presenter and observer instances. Therefore you need to edit the code in the observer window, if you want your audience to see it❗️❗️❗️
  • The carret often becomes invisible, if it is moved outside the non-scrolled area. Still investigating, help wanted.

🙏 Related / Credits

🤝 Contributing

Ideas and feedback are ALWAYS welcome, just submit an issue. Pull Requests are also very welcome, but please always make PRs into the next branch

The library is built using TypeScript, bundled with Microbundle, formatted with Prettier, linted with TSLint and markdownlint, packaged with yarn, hosted on Netlify and developed with love ❤️ and sweat 💦.

  1. yarn dev starts the TypeScript building of the library.
  2. yarn example starts the demo in the example/ folder.
  3. I recommend that you use the example to test your changes, as that contains all the relevant use cases of the library. To do that, run yarn setup-dev, which takes care of installing and linking the necessary dependencies.
  4. Then run yarn start to start the development transpiler and the example in watch mode concurrently.
  5. Submit awesome PRs.

📝 License

Released under the Do No Harm License (draft)

By @DrReinhold