Skip to content

Conversation

@leochiu-a
Copy link
Contributor

@leochiu-a leochiu-a commented Nov 1, 2025

Summary

This PR fixes a bug in the export functionality where the --range parameter was not properly respected during slide export. Previously, when users specified a page range for export (e.g., --range 1-5), the export process would iterate through all slides but only filter the range when determining which pages to export. This resulted in incorrect progress tracking and unnecessary processing of slides outside the specified range.

The fix ensures that only slides within the specified page range are processed and exported, improving both performance and accuracy of the export functionality.

Fix related issue: #2227

Key Changes

  • PNG/Screenshot Export: Modified the screenshot capture loop in exportSlides to skip slides outside the specified range before processing, preventing unnecessary screenshot operations (packages/slidev/node/commands/export.ts:428-430)
  • Progress Tracking: Updated progress counter to accurately reflect the number of slides being processed (based on filtered results) rather than total slide count (packages/slidev/node/commands/export.ts:432)
  • Markdown Export: Added filtering in genPageMd() to only include slides within the specified page range when generating markdown output (packages/slidev/node/commands/export.ts:486)

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • ♻️ Refactoring (no functional changes)
  • 🎨 Style/formatting changes
  • 🧪 Test improvements
  • 🔧 Configuration changes

Test Plan

Manual Testing

  • Export slides with a specific page range (e.g., slidev export --range 1-3) and verify that only slides 1-3 are included in the output
  • Export slides to PNG format with range parameter and confirm that only the specified slides generate PNG files
  • Export slides to markdown format with range parameter and verify the markdown output only contains the specified slides
  • Test edge cases: single slide range (--range 5), non-contiguous ranges (--range 1-3,7-9), and full range to ensure backward compatibility

Breaking Changes

None

Checklist

  • 📝 Code follows the style guidelines
  • 👀 Self-review has been performed
  • 🧪 Tests have been added/updated
  • 📖 Documentation has been updated

@netlify
Copy link

netlify bot commented Nov 1, 2025

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit f0bdfe6
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6905b65b0e24530008e8f502
😎 Deploy Preview https://deploy-preview-2323--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 1, 2025

Open in StackBlitz

@slidev/client

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

create-slidev

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

create-slidev-theme

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

@slidev/parser

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

@slidev/cli

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

@slidev/types

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

commit: f0bdfe6

@antfu antfu merged commit 2c860ee into slidevjs:main Nov 5, 2025
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