-
-
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
2 changed files
with
63 additions
and
25 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,58 @@ | ||
# Pyodide Code Extension for Quarto HTML Documents | ||
# Pyodide Extension for Quarto HTML Documents | ||
|
||
**We're working on finalizing the Quarto extension. We expect this to be completed shortly.** | ||
|
||
This extension enables an interactive Python code cell powered by [pyodide](https://pyodide.org/en/stable/) in a Quarto HTML document. | ||
This extension enables the [Pyodide](https://pyodide.org/en/stable/) code cell within various [Quarto](https://quarto.org/) formats, including [HTML](https://quarto.org/docs/output-formats/html-basics.html), [RevealJS](https://quarto.org/docs/presentations/revealjs/), [Websites](https://quarto.org/docs/websites/), [Blogs](https://quarto.org/docs/websites/website-blog.html), and [Books](https://quarto.org/docs/books). | ||
|
||
> Pyodide is a Python distribution for the browser and Node.js based on WebAssembly. | ||
## Installation | ||
|
||
You can explore what is possible by checking out the proof of concept document here: | ||
To use this extension in a [Quarto project](https://quarto.org/docs/projects/quarto-projects.html), install it from within the project's working directory by typing into **Terminal**: | ||
|
||
<https://rd.thecoatlessprofessor.com/pyodide-quarto-demo/> | ||
``` bash | ||
quarto add coatless-quarto/pyodide | ||
``` | ||
|
||
Have an idea or feedback? Please let us know over in the project's issue tracker: | ||
After the installation process is finished, the extension will be readily available for Quarto documents within the designated working directory. Please note that if you are working on projects located in different directories, you will need to repeat this installation step for each of those directories. | ||
|
||
<https://github.com/coatless-quarto/pyodide/issues> | ||
## Usage | ||
|
||
For each document, place the `pyodide` filter in the document's header: | ||
|
||
```yaml | ||
filters: | ||
- pyodide | ||
``` | ||
Then, place the Python code for `Pyodide` in a code block marked with `{pyodide-python}` | ||
|
||
````markdown | ||
--- | ||
title: Pyodide in Quarto HTML Documents | ||
format: html | ||
filters: | ||
- pyodide | ||
--- | ||
|
||
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!') | ||
``` | ||
```` | ||
|
||
The rendered document can be viewed online [here](https://quarto.thecoatlessprofessor.com/pyodide/examples/readme). | ||
|
||
## Help | ||
|
||
To report a bug, please [add an issue](https://github.com/coatless-quarto/pyodide/issues/new) to the repository's [bug tracker](https://github.com/coatless-quarto/pyodide/issues). | ||
|
||
Want to contribute a feature? Please open an issue ticket to discuss the feature before sending a pull request. | ||
|
||
## Acknowledgements | ||
|
||
For the extension, we greatly appreciated insights from: | ||
|
||
- Pyodide | ||
- [Using Pyodide](https://pyodide.org/en/stable/usage/index.html) | ||
- Quarto Extensions | ||
- [`quarto-ext/shinylive`](https://github.com/quarto-ext/shinylive) | ||
- [`mcanouil/quarto-elevator`](https://github.com/mcanouil/quarto-elevator) | ||
- [`shafayetShafee/downloadthis`](https://github.com/shafayetShafee/downloadthis/tree/main) | ||
- Quarto Documentation | ||
- [Filters Documentation](https://quarto.org/docs/extensions/filters.html) | ||
- [Lua Development Tips](https://quarto.org/docs/extensions/lua.html) | ||
- [Lua API](https://quarto.org/docs/extensions/lua-api.html) | ||
- Pandoc Documentation | ||
- [Example Filters](https://pandoc.org/lua-filters.html#examples) | ||
- [CodeBlock](https://pandoc.org/lua-filters.html#type-codeblock) | ||
- matplotlib patches | ||
- [`gzuidhof/starboard-notebook` graphics patch](https://github.com/gzuidhof/starboard-notebook/blob/4127a5991399532f496da225ecc4ffcc27aa5529/packages/starboard-python/src/pyodide/matplotlib.ts) | ||
- [`jupyterlite/pyodide-kernel` graphics patch](https://github.com/jupyterlite/pyodide-kernel/blob/395525f14b827968cb89a0e507123ae2932d399a/packages/pyodide-kernel/py/pyodide-kernel/pyodide_kernel/patches.py) | ||
Please see our [acknowledgements page](https://quarto.thecoatlessprofessor.com/pyodide/qpyodide-acknowledgements.html). |
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,16 @@ | ||
- Pyodide | ||
- [Using Pyodide](https://pyodide.org/en/stable/usage/index.html) | ||
- Quarto Extensions | ||
- [`quarto-ext/shinylive`](https://github.com/quarto-ext/shinylive) | ||
- [`mcanouil/quarto-elevator`](https://github.com/mcanouil/quarto-elevator) | ||
- [`shafayetShafee/downloadthis`](https://github.com/shafayetShafee/downloadthis/tree/main) | ||
- Quarto Documentation | ||
- [Filters Documentation](https://quarto.org/docs/extensions/filters.html) | ||
- [Lua Development Tips](https://quarto.org/docs/extensions/lua.html) | ||
- [Lua API](https://quarto.org/docs/extensions/lua-api.html) | ||
- Pandoc Documentation | ||
- [Example Filters](https://pandoc.org/lua-filters.html#examples) | ||
- [CodeBlock](https://pandoc.org/lua-filters.html#type-codeblock) | ||
- matplotlib patches | ||
- [`gzuidhof/starboard-notebook` graphics patch](https://github.com/gzuidhof/starboard-notebook/blob/4127a5991399532f496da225ecc4ffcc27aa5529/packages/starboard-python/src/pyodide/matplotlib.ts) | ||
- [`jupyterlite/pyodide-kernel` graphics patch](https://github.com/jupyterlite/pyodide-kernel/blob/395525f14b827968cb89a0e507123ae2932d399a/packages/pyodide-kernel/py/pyodide-kernel/pyodide_kernel/patches.py) |