Skip to content

Commit

Permalink
Merge pull request #1400 from quarto-dev/issue/7939
Browse files Browse the repository at this point in the history
Update RStudio and VS Code manuscript tutorials to use inline code syntax
  • Loading branch information
cwickham authored Oct 22, 2024
2 parents 485943a + bb855ae commit 07efbfe
Showing 1 changed file with 17 additions and 3 deletions.
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

0 comments on commit 07efbfe

Please sign in to comment.