Skip to content

feat: add memory router mode#2660

Merged
antfu merged 1 commit into
slidevjs:mainfrom
quinnypig:feat/router-mode-memory
Jul 10, 2026
Merged

feat: add memory router mode#2660
antfu merged 1 commit into
slidevjs:mainfrom
quinnypig:feat/router-mode-memory

Conversation

@quinnypig

Copy link
Copy Markdown
Contributor

Summary

Adds a third routerMode value — memory — backed by vue-router's createMemoryHistory. Routing is kept entirely in memory, so:

  • the URL never reflects the slide number (no /1, /2, … as the deck advances), and
  • a hard-typed path like /12 is ignored (the deck boots at slide 1).

Existing history (default) and hash behaviour is unchanged.

Why

For kiosk / public "follower" decks — a deck shown on a shared screen or handed out as a public URL that's driven externally (e.g. via a sync addon). Keeping the slide number out of the URL stops viewers from reading their position or jumping ahead by editing the URL. This is URL hygiene, not navigation locking — arrow/click navigation still works; disabling that belongs to the follower layer, not core.

As a bonus it sidesteps the history-mode refresh-404 problem on plain static hosts (there's no path left to 404 on).

Behaviour / limitations

Because memory mode has no URL routing, deep-links, /presenter, /overview, and export-by-URL aren't reachable in this mode. Export and the PNG/PDF build path therefore fall back to history routing (they navigate by URL). These are documented in the routerMode JSDoc.

Changes

  • routerMode type accepts 'memory' (frontmatter config + build-time override)
  • client selects createMemoryHistory via a new __SLIDEV_MEMORY_ROUTE__ build flag (gated off during export)
  • --router-mode CLI flag accepts memory
  • export + PNG build coerce memoryhistory
  • regenerated headmatter schema + updated docs

Verified

pnpm build, pnpm typecheck, pnpm lint, and pnpm test pass. Manually verified in both dev and build: advancing the deck leaves the URL untouched, and a typed /N boots at slide 1.

Add a third `routerMode` value, `memory`, backed by vue-router's
createMemoryHistory. Routing is kept in memory so the URL never reflects
the slide number and cannot be used to navigate — useful for kiosk or
externally driven "follower" decks. Export and the PNG build path fall
back to history routing since they navigate by URL.
@netlify

netlify Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit b85e6fa
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6a4f3a46f8196700080829c1
😎 Deploy Preview https://deploy-preview-2660--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2660

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2660

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2660

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2660

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2660

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2660

commit: b85e6fa

@antfu
antfu merged commit 657a41c into slidevjs:main Jul 10, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants