quarto-dev / quarto-dev/quarto-cli

`output: asis` shouldn't be advertised in OJS cell option documentation (was: OJS variables cannot be used / interpolated within non-executed code blocks)

Open
#6,061 11 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Nov 30, 2023.

documentation yaml-validation
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

First, thank you for your work on this wonderful project!!

I am trying to understand whether Observable variables are able to be used within text formatted as code. As part of this, ojs code blocks seem not to honor the output: asis execution option.

Steps to reproduce
  1. Create a Quarto .qmd file with the following contents:
---
format:
  html:
    code-fold: true
    toc: true
    toc-depth: 6
    toc-expand: 2
    toc-location: right
    number-sections: true
    number-depth: 3
    toc-title: Contents
    anchor-sections: true
    smooth-scroll: true
    embed-resources: true  # Make the file self-contained.
execute:
  freeze: auto  # Re-render only when source changes
---

::: {.callout-important title="Enter variables about your project"}
```{ojs}
//| echo: false

viewof example_variable = Inputs.text({label: "Example variable"})
```
:::

Here is some example code for you to copy and paste:

Test 0: ${example_variable}

Test 1: `${example_variable}`

Test 2: `ojs example_variable`

Test 3:

```{ojs}
//| output: asis
//| echo: false
`
\`\`\`
${example_variable}
\`\`\`
`
```

Test 4:

```sh
# example using ${example_variable}
```
  1. Render the file as HTML
  2. Type "test123" into the input box.
Expected behavior
  1. All tests should replace "example_variable" with test123.
  2. Test 3 should render code-block-formatted text, rather than a string.
Actual behavior
  1. Quarto does not interpolate variables within non-executed code blocks. (Is there an existing alternative syntax for this?)
  2. The output of Test 3 is parsed as a string, rather than as Markdown.

image

Your environment
  • IDE: VSCode 1.76.0, Quarto plugin 1.88.0
  • MacOS Ventura 13.4
Quarto check output
$ quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.433
      Path: /Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.7.16 (Conda)
      Path: /Users/<username>/mambaforge/envs/example_project/bin/python
      Jupyter: 4.12.0
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.