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
@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
- Create a Quarto
.qmdfile 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}
```
- Render the file as HTML
- Type "test123" into the input box.
Expected behavior
- All tests should replace "example_variable" with
test123. - Test 3 should render code-block-formatted text, rather than a string.
Actual behavior
- Quarto does not interpolate variables within non-executed code blocks. (Is there an existing alternative syntax for this?)
- The output of Test 3 is parsed as a string, rather than as Markdown.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.