百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

next-mdx-deck

> 编程语言
开源

使用 MDX、反应和 Next.js 的演示牌

193 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

使用 MDX、反应和 Next.js 的演示牌

Next MDX Deck

Create presentation decks using MDX, React, and Next.js.

Features

  • React-based Slideshow
  • ✍️ Write using Markdown, React components, even HTML!
  • Themeable with CSS vars or Styled Components
  • Swipe to change slides
  • ♻️ Sync slides between browser tabs
  • ‍ Presentation Mode
  • Speaker Notes

Getting Started

  1. Clone the project: git clone https://github.com/whoisryosuke/next-mdx-deck
  2. Install dependencies: npm i or yarn
  3. Run the dev server: npm run dev or yarn dev
  4. Edit the first slide in /pages/index.mdx and save to see changes!

When you're done, run npm run build && npm run export or yarn build && yarn export will create a static app you can deploy anywhere (or use locally). See below for more details.

Deploying

This project is easy to build locally or using a host with build services (like Netlify or Now).

  1. ⚙️ Run the build process: yarn export
  2. Upload the static contents of out folder to host/CDN (or run the out/index.html locally)

How to Use

Changing the Title/Date/etc

The default theme includes a title, date, author (and link to the author's website) in of the `` component. You can edit this data inside the site.config.js file.

✍️ Writing JSX

You can use JSX in a few ways in your MDX files:

  • You can use the syntax with HTML (``)
  • You can import React component from other files (import Button from "../components/Button"). Then you can use that component anywhere in that MDX file. The path to the component is relative to the MDX file.
  • You can use any React component imported into the `` (inside /components/MDXProvider.js). This allows you to use the component without importing it inside each MDX file.
  • You can define React components inside MDX files and then use them. MDX supports the use of JS inside files, like exporting variables, or in this case — defining new functions. const Button = () =>

Check out the MDX docs for more information on the syntax.

Creating Slide Pages

You can create new slide pages by making new .mdx files inside the /pages/ directory. Each slide is separated by a markdown divider (---).

You have to wrap the contents of each .mdx file with a `` component. This is what breaks up each slide page into individual slides using the markdown dividers.

Navigation

Slide pages represent real pages - so page-2.mdx == your-site.com/page-2. By using the next prop on the `` component you can control the next page you navigate to (after you go through all the slides).

javascript
// Navigates to your-site.com/your-custom-page after all slides complete

Theming the Slideshow

Theming is accomplished with CSS custom properties and/or Styled Components.

Design tokens are stored as CSS custom properties inside the SlidePage layout (/layouts/SlidePage.jsx), which are injected into the app using Styled Component's global styling utility. There you can change the color of text, background colors, fonts, etc.

The actual CSS styles of the Slideshow are also stored in the SlidePage layout. There you can change the padding of slides, alignment of quotes, etc.

When the Markdown is parsed into HTML, you can replace HTML with React components. These "swaps" are handled by the component. You can import custom components and swap elements (like a with ``), or import components to use inside MDX (great for creating things like 2-col layouts with component). There you can change the syntax highlighting or find any custom MDX components. It's recommended to use Styled Components there to create custom components.

Presentation Mode

Presentation mode allows you to view the current slide alongside any "speaker notes" included inside the slide.

  • Press ALT/OPT + P to toggle presentation mode on and off.
  • You can also add the mode query parameter to the URL (e.g. http://localhost:3000/slides/1?mode=presentation).

The most common way to use presentation mode:

  1. Open two browser tabs with any slide page.
  2. Activate presentation mode in one tab.
  3. Navigate through slides - they'll be synced in both tabs!

This way you can view your presentation on one monitor, while displaying the slides on another screen. Or if you're livestreaming, you can capture the slideshow window in software like OBS, and view the presentation window privately.

Note that syncing between tabs is achieved using localStorage. If you want to use an "Incognito" browser, make sure both tabs are "incognito" or they won't sync.

Speaker Notes

Speaker notes are only displayed during presentation mode. This allows you to write private notes to yourself that you can see in "presentation" mode, while the audience only sees the other slide content in "slideshow" mode.

Speaker notes can contain Markdown, MDX/JSX, and even HTML (as JSX). The notes are displayed in a scrollable window to the side of slide content during "presenation" mode.

To create speaker notes, you use the `` component inside of your MDX files. No need to import it, it's automatically imported into any MDX slide page. You can also use it multiple times within the same slide, all the notes (per slide) will be combined.

Here's an example:

mdx
Slide content would go here.

    
Private notes here.

# Even Markdown!

Adding/replacing components in MDX

MDX allows you to use JSX inline or import components, but if you want to use a React component across all slides without importing it, you can use the `` component. This component wraps the app in a "context" that provides MDX with components to pass into the parser.

This also lets you replace Markdown parsed HTML elements with React components, like replacing ## Headings with instead of the default ` `. This comes in handy if you have a React component library and you want to use it's primitives like for paragraphs.

You can pass new components, or swap HTML elements inside the mdComponents object in the /components/MDXProvider.jsx file:

javascript
const mdComponents = {
  h1: (props) => 
,
  CustomButton,
};

Available Components

Framer Motion

You can use any Framer Motion component:

mdx

# Your animated header

Cover

Displays content centered and larger, commonly for the first slide in a deck.

mdx

# NextJS MDX Deck

Create presentations using Next & React & MDX.

Steps

Reveals content step by step as the user does next/prev slide button.

mdx

  Something
  happens
  one
  by
  one
  easy to add stuff

Custom order

You can also define the order explicitly:

mdx

  Third
  Second
  First

Duration

You can control the animation duration using the prop and providing an integer (representing seconds):

mdx

  {/** 3 seconds **/}
  Something
  happens

Learn More

MDX

To learn more about MDX, take a look at the following resources:

  • MDX Documentation
  • Getting started with MDX
  • Using MDX with Next.js

Next.js

To learn more about Next.js, take a look at the following resources:

  • Next.js Documentation - learn about Next.js features and API.
  • Learn Next.js - an interactive Next.js tutorial.

References

  • MDX Deck
  • Gatsby Starter Deck
  • react-syntax-highlighter

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言