-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.quarto/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../_extensions/pyodide/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
project: | ||
title: "index" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
title: "{quarto-pyodide} Demo RevealJS Document" | ||
format: revealjs | ||
filters: | ||
- pyodide | ||
--- | ||
|
||
## Welcome | ||
|
||
Welcome to a demo RevealJS presentation that uses the [`quarto-pyodide`](https://github.com/coatless-quarto/pyodide) extension to generate interactive code cells with [Quarto](https://quarto.org) and [Pyodide](https://pyodide.org/en/stable/). | ||
|
||
Not the right template? Let's go back to the [documentation portal](../../) | ||
|
||
## Pyodide in RevealJS | ||
|
||
This is a Pyodide-enabled code cell in a Quarto HTML document. | ||
|
||
```{pyodide-python} | ||
n = 5 | ||
while n > 0: | ||
print(n) | ||
n = n - 1 | ||
print('Blastoff!') | ||
``` | ||
|
||
## matplotlib Graphing with Pyodide | ||
|
||
```{pyodide-python} | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
x = np.linspace(0, 2*np.pi, 100) | ||
y = np.sin(x) | ||
plt.plot(x, y) | ||
plt.title('Sine wave') | ||
plt.show() | ||
``` | ||
|
||
## quarto-{pyodide + countdown} | ||
|
||
Pair code cells with a [countdown timer](https://github.com/gadenbuie/countdown/tree/main/quarto) to allow for practice | ||
|
||
{{< countdown 00:05 top = 0 >}} | ||
|
||
Fill in the following function to say hi! | ||
|
||
```{pyodide-python} | ||
def say_hello(name): | ||
_________(f"Hello there {name}!") | ||
say_hello("quarto-pyodide") | ||
``` | ||
|
||
|
||
## Keyboard Shortcuts | ||
|
||
- Run selected code using either: | ||
- macOS: <kbd>⌘</kbd> + <kbd>↩/Return</kbd> | ||
- Windows/Linux: <kbd>Ctrl</kbd> + <kbd>↩/Enter</kbd> | ||
- Run the entire code by clicking the "Run code" button or pressing <kbd>Shift</kbd>+<kbd>↩</kbd>. | ||
|
||
```{pyodide-python} | ||
print("Hello quarto-pyodide RevealJS world!") | ||
[x**2 for x in range(0, 5)] | ||
3 + 5 | ||
``` | ||
|
||
## Fin | ||
|
||
Thanks for checking out the demo! Let's head back to | ||
the [documentation portal](../../). |