The extensions including coatless/webr
and monash
are tweaked. Please copy those extensions as is.
There are some features that could be useful for your slides
To display an image file as an icon, use it as a class for an <img>
element. This is useful for including images in titles or text.
.png-icon {
height:1em;
width:1em;
vertical-align:-0.125em;
margin-left:auto;
margin-right:auto;
font-size:inherit;
fill:currentColor;
overflow:visible;
position:relative;
margin-top:0px !important;
margin-bottom:0px !important;
}
_extensions/monash/assets/time.js
includes a refreshTime()
function that updates the content of an HTML element every second based on the current time. This function powers the clock displayed in the slide footer. You can customize the element ID, time format, time zone, and update frequency to suit your needs.
_extensions/coatless/webr
is a Quarto WebR extension. It powers the interactive R console in the slide. The document can be found in https://quarto-webr.thecoatlessprofessor.com/. Here I provide a FAQ.
- Copy the extension to your project or install it using the instructions at https://github.com/coatless/quarto-webr/
- Define the filters for your Quarto slides as follows:
filters:
- webr
- Use {webr-r} for your code chunks, for example:
```{webr-r}
summary(cars)
```
- Keep in mind that standard R code chunks
{r}
do not interact with the environment of{webr-r}
.
There are three context types for quarto-webr
code chunks: interactive, output, and setup. You can specify the context as shown below:
```{webr-r}
#| context: interactive
summary(cars)
```
The output
context type hides the code and only displays the results. Setting echo: true
will still not display the code.
The setup
context type runs the code in the background but may take up space during the webR initialization and display some startup messages. To suppress this, you can wrap the code chunk with:
::: {style="display: none;"}
:::
To adjust the font size of quarto-webr
code chunks, you can set the editor-font-scale
individually for each chunk or apply it globally with:
webr:
cell-options:
editor-font-scale: 0.6
The default value for Quarto slides is 0.5. This setting scales the font size relative to the page font size.
Set read-only
to true
for the code chunk.
5. How can I control the maximum height of the quarto-webr
editor to prevent it from growing indefinitely?
You can set editor-max-height
for individual code chunks or globally. The value is specified in pixels.
You can set autorun
to true
for individual code chunks or globally.
This might be because you set message
and warning
to false, which suppresses all messages, including warnings and errors. If an error occurs, the code cannot be executed.
No, this feature is not currently supported, and implementing it is quite complex. It isn't likely to be supported anytime soon.
Yes, but you’ll need to modify the extension directly. In _extensions/coatless/webr/qwebr-monaco-editor-element.js
, locate the monaco.editor.create()
method and add guides: { indentation: false }
. This will disable the indentation guides. For a full list of available options, refer to the Monaco Editor documentation.
You need to adjust the CSS for the quarto-webr
output code area as follows:
.h300-webr-pre-output .qwebr-output-code-area pre {
max-height: 500px !important;
}
When you wrap the quarto-webr
code chunk with this class, the maximum height of it will be limited
::: {.h300-webr-pre-output}
```{webr-r}
lapply(1:100, rnorm)
```
:::
Yes, it's possible, but it's not straightforward. For more details, see the Monarch documentation.
Yes, you can use existing tools like prismjs
to modify the <code>
elements directly.
This could be because a variable is overridden in a later quarto-webr
code chunk. Similar to RMarkdown, code chunks in quarto-webr
are not independent and can affect one another.
Specify the packages in the YAML header:
webr:
packages: ['tidyverse', 'nycflights13']
Make sure to load the packages using library()
, or set:
webr:
packages: ['tidyverse', 'nycflights13']
autoload-packages: true
Yes, you can disable it by adding the following to your YAML header:
webr:
show-startup-message: false