Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions docs/manuscripts/authoring/_inline-computations.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,29 @@ avg_years_between_eruptions
```
:::

::: {.content-visible unless-meta="tool.is_rstudio"}
::: {.content-visible when-meta="tool.is_jupyterlab"}
You can also use computed values directly in your article text by using inline code. Read more in [Inline Code](/docs/computations/inline-code.qmd).
:::

::: {.content-visible when-meta="tool.is_rstudio"}
You can use computed values directly in your article text using the syntax `` `r expr` ``. For example, consider this line in `index.qmd`:
You can use computed values directly in your article text using the syntax `` `{{r}} expr` ``. For example, consider this line in `index.qmd`:

``` markdown
Based on data up to and including 1971, eruptions on La Palma happen every `{{r}} round(avg_years_between_eruptions, 1)` years on average.
```

When rendered, it displays as:

> Based on data up to and including 1971, eruptions on La Palma happen every 79.8 years on average.

You can read more about using code inline at [Inline Code](/docs/computations/execution-options.qmd#inline-code).
:::

::: {.content-visible when-meta="tool.is_vscode"}
You can use computed values directly in your article text using the syntax `` `{{python}} expr` ``. For example, consider this line in `index.qmd`:

``` markdown
Based on data up to and including 1971, eruptions on La Palma happen every `r round(avg_years_between_eruptions, 1)` years on average.
Based on data up to and including 1971, eruptions on La Palma happen every `{{python}} f"{avg_years_between_eruptions:.1f}"` years on average.
```

When rendered, it displays as:
Expand Down