Skip to content

Commit eccb263

Browse files
Revamped create-spectacle CLI and getting started documentation for Spectacle. (#1306)
* Added base support for generating Markdown slide decks * Update deps, move to TypeScript-only. * Finish MD file writer. Clean up React template and use new Spectacle primatives. * Start docs refactor for new CLI based getting started guide * Finish docs and CLI copy. * Update CLI tests for new markdown option. * Update GH Actions to remove old JS option.
1 parent e7c3adb commit eccb263

20 files changed

+215
-494
lines changed

.github/workflows/create-spectacle.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ on:
55
branches:
66
- main
77
paths:
8-
- ".github/workflows/create-spectacle.yml"
9-
- "packages/create-spectacle/**"
8+
- '.github/workflows/create-spectacle.yml'
9+
- 'packages/create-spectacle/**'
1010
pull_request:
1111
branches:
1212
- main
1313
paths:
14-
- ".github/workflows/create-spectacle.yml"
15-
- "packages/create-spectacle/**"
14+
- '.github/workflows/create-spectacle.yml'
15+
- 'packages/create-spectacle/**'
1616

1717
jobs:
1818
build:
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
matrix:
2424
node-version: [18.x]
25-
create-type: ['jsx', 'tsx', 'onepage']
25+
create-type: ['tsx', 'onepage']
2626
steps:
2727
- uses: actions/checkout@v2
2828
- uses: actions/setup-node@v2

docs/faq.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Yes - you can export your slides in PDF format. Appending your presentation URL
1212

1313
If you want a black & white version of your slides printed to PDF, append your URL with `?exportMode=true&printMode=true` to get a printer-friendly, flattened, black & white print out of your slideshow.
1414

15-
For more info about the query parameters Spectacle supports, please check out our section about it in the [advanced concepts documentation](./advanced-concepts.md#query-parameters).
15+
For more info about the query parameters Spectacle supports, please check out our section about it in the [presenting controls documentation](./presenting-controls#query-parameters).
1616

1717
## Can I write my presentation in TypeScript?
1818

19-
Yes - Spectacle types are shipped with the package, so you can safely use Spectacle in any `.ts` or `.js` presentation without a separate type definition import.
19+
YesSpectacle types are shipped with the package, so you can safely use Spectacle in any `.ts` or `.js` presentation without a separate type definition import. TypeScript is now the default language for Spectacle and the `create-spectacle` CLI, so you can use it without any additional configuration.

docs/index.md

-149
This file was deleted.

docs/index.mdx

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: Introduction
3+
order: 1
4+
sidebar_position: 1
5+
---
6+
7+
import Tabs from '@theme/Tabs';
8+
import TabItem from '@theme/TabItem';
9+
import defaultDeckImg from '../website/static/img/default-deck.png'
10+
import presenterModeImg from '../website/static/img/presenter-mode.png'
11+
import animatedPresentationImg from '../website/static/img/presentation-mode.gif'
12+
13+
Spectacle is a React-based library for creating sleek presentations using React or Markdown that gives you the ability to live demo your code and use React libraries in your slides.
14+
15+
<img src={defaultDeckImg} style={{ width: '40rem'}} />
16+
17+
## How to get started with Spectacle
18+
19+
20+
<Tabs>
21+
<TabItem value="spectacle-cli" label="Create Spectacle CLI" default>
22+
The fastest and easiest way to get started with Spectacle is to use the Create Spectacle CLI. This will create a new Spectacle project with a default deck and all the necessary dependencies.
23+
24+
There are four different kinds of templates you can use to create your Spectacle project:
25+
26+
1. ⚡️ **One Page** - A single HTML file using [htm](https://github.com/developit/htm) that self contains everything you need. Since it does not require a server to run your presentation, this is the recommended option for quickly spinning up a deck.
27+
2. 📄 **Markdown** - An app that uses Markdown for your presentation’s content with support for [Markdown Slide Layouts](md-slide-layouts). This is a React app that uses webpack and imports the Markdown content using Spectacle’s [`MarkdownSlideSet`](api-reference#markdown-components) component.
28+
3. 🏗️ **React using Vite** - An app that lets you build your presentation in React and uses Vite for building and running. This is the recommended option if you plan on using a number of additional npm libraries in your presentation.
29+
4. 🏗️ **React using webpack** - An app that lets you build your presentation in React and uses webpack for building and running.
30+
31+
**To get started use `npx` or `pnpm dlx` to run the `create-spectacle` cli:**
32+
33+
```bash
34+
35+
$ npx create-spectacle
36+
37+
```
38+
39+
This will create a new Spectacle presentation in a directory of your deck’s name or one page file in the current directory.
40+
41+
42+
</TabItem>
43+
<TabItem value="autoPlay" label="Manual Installation" default>
44+
45+
1. Install Spectacle by running `npm add spectacle`.
46+
47+
2. In your main entry file, return the following Spectacle starter:
48+
49+
```tsx
50+
import { Deck, Slide, Heading, DefaultTemplate } from 'spectacle';
51+
52+
function App() {
53+
return (
54+
<Deck template={<DefaultTemplate />}>
55+
<Slide>
56+
<Heading>Welcome to Spectacle</Heading>
57+
</Slide>
58+
</Deck>
59+
);
60+
}
61+
62+
export default App;
63+
```
64+
65+
:::info
66+
67+
If you are using NextJS with App Router, Spectacle needs to be rendered inside a client component. You can read more about this [here](https://nextjs.org/docs/app/building-your-application/rendering/client-components).
68+
69+
:::
70+
71+
72+
</TabItem>
73+
</Tabs>
74+
75+
## Presenter Mode
76+
77+
Spectacle also has a presenter mode that allows you to view your slides and notes on one screen while your audience views your slides on another. To use presenter mode, open a second browser window and visit your deck’s local server and enable it by using the key command. You can find more information about presentation controls [here](presenting-controls).
78+
79+
<img src={presenterModeImg} style={{ width: '40rem'}} />
80+
<img src={animatedPresentationImg} style={{ width: '40rem'}} />
81+
82+
83+
## Documentation, Contributing, and Source
84+
85+
For more information about Spectacle and its components, check out [the docs](https://formidable.com/open-source/spectacle).
86+
87+
Interested in helping out or seeing what's happening under the hood? Spectacle is maintained [on Github](https://github.com/FormidableLabs/spectacle) and you can [start contributing here](https://github.com/FormidableLabs/spectacle/blob/main/CONTRIBUTING.md).
88+
89+
For any questions, feel free to [open a new question on Github](https://github.com/FormidableLabs/spectacle/issues/new?template=question.md).
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
---
2-
title: Advanced Concepts
2+
title: Presenting Controls
33
order: 2
44
sidebar_position: 2
55
---
66

7-
# Advanced Concepts
7+
import commandBarImage from "../website/static/img/command-bar.png"
88

9-
## Build & Deployment
9+
# Presenting Controls
1010

11-
There are a variety of ways to host your Spectacle presentation.
11+
Spectacle comes with a few keyboard shortcuts to help you navigate your presentation. These shortcuts are available in both the browser and the Presenter Mode. You can also use the command bar to see all available shortcuts.
1212

13-
1. If you are integrating this lib yourself, take your build and follow the linked instructions from any of (but not limited to) the following providers: [Netlify](https://docs.netlify.com/get-started/#deploy-a-project-to-netlify), [Vercel](https://vercel.com/docs/concepts/deployments/overview), or [Surge](https://surge.sh/help/deploying-continuously-using-git-hooks).
13+
## Command Bar
14+
15+
Pressing <kbd>&#8984;</kbd>/<kbd>Ctrl</kbd> + <kbd>k</kbd> will open the command bar. This will show you all available keyboard shortcuts and common navigation options.
16+
17+
<img src={commandBarImage} alt="Command Bar interface" style={{ width: "30rem" }} />
1418

15-
2. If using `spectacle-cli` (either `spectacle --action build` or `spectacle-boilerplate` with `yarn clean && yarn build`) your output is `dist/` and upload that directory to any of the above static hosting providers.
1619

1720
## Keyboard Controls
1821

1922
| Key Combination | Function |
2023
| --------------- | ---------------------- |
21-
| Right Arrow | Next Slide |
22-
| Left Arrow | Previous Slide |
23-
| Alt/Option + O | Toggle Overview Mode |
24-
| Alt/Option + P | Toggle Presenter Mode |
25-
| Alt/Option + F | Toggle Fullscreen Mode |
24+
| <kbd aria-label="Arrow Right Key">&#8594;</kbd> | Next Slide |
25+
| <kbd>&#8592;</kbd> | Previous Slide |
26+
| <kbd>&#8997;</kbd>/<kbd>Alt</kbd> + <kbd>&#8679;</kbd> + <kbd>O</kbd> | Toggle Overview Mode |
27+
| <kbd>&#8997;</kbd>/<kbd>Alt</kbd> + <kbd>&#8679;</kbd> + <kbd>P</kbd> | Toggle Presenter Mode |
28+
| <kbd>&#8997;</kbd>/<kbd>Alt</kbd> + <kbd>&#8679;</kbd> + <kbd>F</kbd> | Toggle Fullscreen Mode |
2629

2730
## Query Parameters
2831

@@ -34,4 +37,4 @@ To combine parameters, use multiple `&` to separate the parameters, e.g.: `&expo
3437
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
3538
| `exportMode` | For exporting your presentation as a PDF. Add it to your project URL and "Save to PDF" directly from the browser |
3639
| `printMode` | Turns your slideshow into a printer-friendly, black & white version. Meant for use concurrently with `?exportMode` e.g. `?exportMode=true&printMode=true` |
37-
| `presenterMode` | Displays a Presenter Mode for ease of presentation. For more info on this mode, please see [Presenting](./index.md#presenting) in our Basic Concepts doc |
40+
| `presenterMode` | Displays a Presenter Mode with slide notes, a timer, and the upcoming slide. |

docs/jsx-slide-layouts.md docs/react-slide-layouts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: JSX Slide Layouts
2+
title: React Slide Layouts
33
order: 6
44
sidebar_position: 6
55
---

0 commit comments

Comments
 (0)