Problem Statement
When presenting to different audiences (e.g., developers, architects, managers, clients), it would be useful to selectively show or hide slides without maintaining separate slide decks or using external build scripts.
Currently, Slidev's preparser system (setup/preparser.ts) allows custom filtering, but there is no built-in solution for audience-based slide visibility.
Proposed Solution
Add native support for two new frontmatter fields:
showFor – Comma-separated list or array of audiences that should see this slide
hideFor – Comma-separated list or array of audiences that should NOT see this slide
The active audience would be specified via:
- Environment variable
AUDIENCE (CLI override, highest priority)
- Headmatter
audience field in slides.md
When no audience is configured, all slides remain visible (backward compatible).
Example Usage
---
layout: default
showFor: devs, architects
---
# Technical Deep Dive
This slide is only visible when `AUDIENCE=devs` or `AUDIENCE=architects`.
---
layout: default
hideFor: managers
---
# Implementation Details
This slide is hidden when `AUDIENCE=managers`.
# Run with specific audience
AUDIENCE=devs slidev
AUDIENCE=managers slidev build
Reference Implementation
I've implemented this as a project-local preparser extension and it works well. The key aspects:
- Uses existing
definePreparserSetup hook
- Leverages
frontmatter.disabled to hide slides
- Supports both comma-separated strings and arrays
- Case-insensitive audience matching
- No audience set = all slides visible (backward compatible)
I'm happy to implement this
I already have a working reference implementation and would be glad to contribute a PR for this feature — either way you prefer:
Option A: Built-in integration
- Core preparser integration in
@slidev/parser
- Documentation update for
sli.dev
- Tests for the new frontmatter fields and environment variable handling
Option B: Official Slidev Addon
- I publish it as
slidev-addon-audience-filter on npm
- Add it to the Addon Gallery
- Maintained independently but following Slidev conventions
Either way, you would have no work to do — I'll handle the implementation and maintenance. Just let me know which approach aligns better with the project's direction and I'll get started!
Problem Statement
When presenting to different audiences (e.g., developers, architects, managers, clients), it would be useful to selectively show or hide slides without maintaining separate slide decks or using external build scripts.
Currently, Slidev's preparser system (
setup/preparser.ts) allows custom filtering, but there is no built-in solution for audience-based slide visibility.Proposed Solution
Add native support for two new frontmatter fields:
showFor– Comma-separated list or array of audiences that should see this slidehideFor– Comma-separated list or array of audiences that should NOT see this slideThe active audience would be specified via:
AUDIENCE(CLI override, highest priority)audiencefield inslides.mdWhen no audience is configured, all slides remain visible (backward compatible).
Example Usage
# Run with specific audience AUDIENCE=devs slidev AUDIENCE=managers slidev buildReference Implementation
I've implemented this as a project-local preparser extension and it works well. The key aspects:
definePreparserSetuphookfrontmatter.disabledto hide slidesI'm happy to implement this
I already have a working reference implementation and would be glad to contribute a PR for this feature — either way you prefer:
Option A: Built-in integration
@slidev/parsersli.devOption B: Official Slidev Addon
slidev-addon-audience-filteron npmEither way, you would have no work to do — I'll handle the implementation and maintenance. Just let me know which approach aligns better with the project's direction and I'll get started!