Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/builtin/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Options:
- `--base` (`string`, default: `/`): base URL (see https://vitejs.dev/config/shared-options.html#base)
- `--download` (`boolean`, default: `false`): allow the download of the slides as a PDF inside the SPA
- `--theme`, `-t` (`string`): override theme
- `--without-notes` (`boolean`, default: `false`): exclude speaker notes from the SPA

## `slidev export [...entry]` {#export}

Expand Down
8 changes: 8 additions & 0 deletions docs/guide/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ You can change the output directory using `--out`.
$ slidev build --out my-build-folder
```

### Remove speaker notes {#without-notes}

If you are sharing the built slides publicly and don't want to include your speaker notes, run the build with `--without-notes`:

```bash
$ slidev build --without-notes
```

### Multiple Builds {#multiple-builds}

You can build multiple slide decks in one go by passing multiple markdown files as arguments:
Expand Down
8 changes: 6 additions & 2 deletions packages/slidev/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ cli.command(
type: 'boolean',
describe: 'allow download as PDF',
})
.option('without-notes', {
type: 'boolean',
describe: 'exclude speaker notes from the built output',
})
.option('inspect', {
default: false,
type: 'boolean',
Expand All @@ -355,11 +359,11 @@ cli.command(
.strict()
.help(),
async (args) => {
const { entry, theme, base, download, out, inspect } = args
const { entry, theme, base, download, out, inspect, 'without-notes': withoutNotes } = args
const { build } = await import('./commands/build')

for (const entryFile of entry as unknown as string[]) {
const options = await resolveOptions({ entry: entryFile, theme, inspect, download, base }, 'build')
const options = await resolveOptions({ entry: entryFile, theme, inspect, download, base, withoutNotes }, 'build')

printInfo(options)
await build(
Expand Down
6 changes: 5 additions & 1 deletion packages/slidev/node/vite/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function createSlidesLoader(
options: ResolvedSlidevOptions,
serverOptions: SlidevServerOptions,
): Plugin {
const { data, mode, utils } = options
const { data, mode, utils, withoutNotes } = options

const notesMd = MarkdownIt({ html: true })
notesMd.use(markdownItLink)
Expand Down Expand Up @@ -363,6 +363,9 @@ export function createSlidesLoader(
}

function renderNote(text: string = '') {
if (withoutNotes)
return ''

let clickCount = 0
const notesAutoRuby: Record<string, string | undefined> = (data.headmatter as any).notesAutoRuby || {}

Expand Down Expand Up @@ -399,6 +402,7 @@ export function createSlidesLoader(
function withRenderedNote(data: SlideInfo): SlideInfo {
return {
...data,
...withoutNotes && { note: '' },
noteHTML: renderNote(data?.note),
}
}
Expand Down
9 changes: 5 additions & 4 deletions packages/types/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export interface ExportArgs extends CommonArgs {
}

export interface BuildArgs extends ExportArgs {
out: string
base?: string
download?: boolean
inspect: boolean
'out': string
'base'?: string
'download'?: boolean
'inspect': boolean
'without-notes'?: boolean
}
5 changes: 5 additions & 0 deletions packages/types/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export interface SlidevEntryOptions {
* Base URL in dev or build mode
*/
base?: string

/**
* Exclude speaker notes from the built output
*/
withoutNotes?: boolean
}

export interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
Expand Down
Loading