Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Jul 31, 2024
1 parent bba4bd3 commit 17e302b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
61 changes: 31 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,73 @@ The `quarto-live` extension focuses on providing:
* Interactive "sandbox" R and Python code blocks.
* Exercises with optional hints, solutions, and custom grading algorithms.
* Rich client-side output such as interactive plots, images, and HTML widgets.
* A customisable CodeMirror-based editor with automatic theming, syntax highlighting, autocomplete, local browser storage, and autorun capabilities.
* A customisable CodeMirror-based editor with automatic theming, syntax highlighting, autocomplete, code persistence, and autorun capabilities.
* Integration with Quarto's OJS engine so that `quarto-live` code cells update reactively with `{ojs}` cells.

## Installation

To use the `quarto-live` extension in your own documents, run the following command in a terminal with a Quarto project as the working directory:

```
quarto add r-wasm/quarto-live
```

### NOTE
Once installed, the extension can be used with Quarto documents within this project.

## Basic Setup

While this repo remains private, something like the following installation method should be used:
Set the `live` custom format in your Quarto document's YAML header. For slides, use `format: live-revealjs`.

```
git clone https://github.com/r-wasm/quarto-live quarto-live
quarto add quarto-live
```yaml
---
format: live-html
---
```

## Basic Setup
The default rendering engine used by Quarto is `jupyter`, requiring a Python installation. If you’d prefer to avoid Python you can also explicitly select the `knitr` engine in the document’s YAML header:

```yaml
---
format: live-html
engine: knitr
---
```

Set the `live` custom format in your Quarto document's yaml header. For ReactJs slides, use `format: live-revealjs`.
Next, after the YAML header but before your content, include setup code for the `knitr` engine using a relative path:

```yaml
---
title: A Quarto Live Document
format: live-html
engine: knitr
---

{{< include ./_extensions/r-wasm/live/_knitr.qmd >}}
```

**NOTE:** Including `_knitr.qmd` is not strictly required if you are using the `jupyter` rendering engine. It is a temporary requirement for the `knitr` engine and will be removed in a future release of `quarto-live`.

## Usage

Add an interactive code block into your document using the `{webr}` (for R code) or `{pyodide}` (for Python code) code block types:

````markdown
````yaml
---
title: A Quarto Live Document
engine: knitr
format: live-html
---

```{webr}
fit = lm(mpg ~ am, data = mtcars)
summary(fit)
plot(fit)
```
````
{{< include ./_extensions/r-wasm/live/_knitr.qmd >}}

### Using the `knitr` engine

The `quarto-live` extension works with both the `knitr` and `jupyter` engine. If Quarto fails to run, showing errors about a missing `jypyter` or `python` installation, explicitly select the `knitr` engine using `engine: knitr`.

Additionally, when using the `knitr` engine, ensure `quarto-live` code block types are given with a leading `.` character:

````
```{.webr}
```{webr}
fit = lm(mpg ~ am, data = mtcars)
summary(fit)
plot(fit)
```
````

**NOTE:** This requirement is temporary and will no longer be required in a future release of `quarto-live`.

## Documentation
Further documentation of how to use `quarto-live` in your documents to create rich interactive content can be found at:

With this pre-release version, documentation is currently incomplete. However, a Quarto website showing some examples of how to use `quarto-live` can be found in the `docs` directory.

The website output can be found here: https://quarto-live-dev.netlify.app, but the Quarto source code is likely to be more useful for the moment.

Documentation will be rewritten and expanded before public release.
https://quarto-live-dev.netlify.app
6 changes: 3 additions & 3 deletions docs/getting_started/installation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ Once installed, the extension can be used with Quarto documents within this proj

## Usage

First set the format for your Quarto document as a `live` variant in the `yaml` header:
First set the format for your Quarto document as a `live` variant in the YAML header:

````yaml
---
format: live-html
---
````

Note that the default rendering engine used by Quarto is `jupyter`, requiring a Python installation. If you'd prefer to avoid Python you can also explicitly select the `knitr` engine in the document's `yaml` header:
The default rendering engine used by Quarto is `jupyter`, requiring a Python installation. If you'd prefer to avoid Python you can also explicitly select the `knitr` engine in the document's YAML header:

```yaml
---
Expand All @@ -32,7 +32,7 @@ engine: knitr
---
```

Next, after the `yaml` header but before your content, include setup code for the knitr engine using a relative path:
Next, after the YAML header but before your content, include setup code for the knitr engine using a relative path:

```yaml
---
Expand Down

0 comments on commit 17e302b

Please sign in to comment.