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

@digicrafters/slidev-export-cli

v1.0.1

Published

CLI tool to export Slidev presentations based on a JSON configuration file.

Readme

slidev-export-cli

README-fr.md only on repository

An open-source CLI tool designed to automate and simplify PDF exports from Slidev presentations. It generates multiple exports from a single Slidev source using a JSON configuration file.

This tool is particularly well-suited for long teaching materials (courses, modules, chapters), where each export represents a targeted version of the same document. You can easily produce one PDF per chapter, per module, or per variant, while maintaining one single Slidev source file.


Key Features

  • Automatic token replacement in .md files (e.g., $chapter-title$, $output-file-name$, $file-name$, etc.)
  • Multiple configurable exports defined in a JSON file
  • Native integration with slidev export → full support for custom options (--wait, --with-toc, etc.)
  • Automatic handling of temporary files
  • Selective export using indexes (0 3 4)
  • Compatible with Windows, macOS, and Linux
  • Usable via npx, as a local dependency, or globally
  • Ideal for generating one PDF per chapter from long-form Slidev content

Installation

Option 1 — As a devDependency (recommended)

npm install --save-dev  @digicrafters/slidev-export-cli

Option 2 — Via npx (no installation)

npx  @digicrafters/slidev-export-cli path/to/config.json

Option 3 — Global installation

npm install -g  @digicrafters/slidev-export-cli

Usage

From the root of your Slidev project:

cd my-slidev-project
slidev-export-cli path/to/config.json

Examples

Full export

slidev-export-cli config/chapters.json

Selective export (indexes 0, 2, and 4)

slidev-export-cli config/chapters.json 0 2 4

example/ Directory

The project includes a ready-to-use example:

example/
 ├── configuration-file.json  → configuration with multiple exports
 └── slidev-chapter.md        → Slidev file using token placeholders

Try it immediately:

cd example
slidev-export-cli configuration-file.json

Several PDFs will be generated inside export/, each one corresponding to a different parameter set.


Configuration Example

{
  "targetPath": "slidev-chapter.md",
  "tempPath": "temp-chapter.md",
  "deleteTempFile": false,
  "exportOptions": ["--with-toc"],
  "exports": [
    {
      "replacementValues": [
        { "name": "output-file-name", "value": "generated-file-01" },
        { "name": "file-name",   "value": "chapter-01" },
        { "name": "some-name",   "value": "value for first export" },
        { "name": "another-name","value": "another first export value" }
      ]
    },
    {
      "replacementValues": [
        { "name": "output-file-name", "value": "generated-file-02" },
        { "name": "file-name",   "value": "chapter-02" },
        { "name": "some-name",   "value": "value for second export" },
        { "name": "another-name","value": "another second export value" }
      ]
    }
  ]
}

Tokens in Markdown Files

General format:

$token-name$

Examples:

  • $output-file-name$
  • $file-name$
  • $some-name$
  • $another-name$

Excerpt from the provided Slidev example:

exportFilename: ../export/$output-file-name$.pdf

Automatic Validation

Before exporting, the tool validates:

  • the existence of the JSON configuration file,
  • the validity of the configured paths,
  • the existence of the target Markdown file,
  • the validity of provided export indexes,
  • that the indexes do not exceed the number of configured export entries.

If an error occurs, an explicit message is displayed and the export stops.


Recommended npm Scripts

Inside your Slidev project (package.json):

{
  "scripts": {
    "export:slides": "slidev-export-cli config/configuration-file.json"
  }
}

Run it with:

npm run export:slides

Project Philosophy

slidev-export-cli aims to remain simple, reliable, and easy to extend.

Its goals include:

  • streamlining the export of educational or documentation material,
  • automating the generation of segmented PDFs,
  • integrating smoothly into automated publication or CI workflows.

Contributions are welcome: bug fixes, feature ideas, improvements—anything that helps the Slidev community.


npm Publishing (for maintainers)

The package is automatically built before publishing:

npm run build
npm publish

For scoped packages:

npm publish --access public

License

MIT © DigiCrafters


Contributing

  • Fork the repository
  • Create a feature branch
  • Open a pull request
  • Report a bug or propose an enhancement

All contributions are welcome.


Contact

For questions or suggestions, open an issue on: https://framagit.org/digicrafters/slidev-export-cli