Is it possible to check multiple conditions for conditional rendering? #9295
-
DescriptionIs it possible to check multiple conditions for conditional rendering? For example, can I render some sections for HTML or ipynb, while another section for PDF or docx? ---
title: Reprex
execute:
echo: false
format:
html:
code-tools: true
pdf: default
docx: default
ipynb:
echo: true
---
This is always visible.
::: {.content-visible when-format="html|ipynb"}
```{python}
print("This is in HTML or ipynb")
```
:::
::: {.content-visible when-format="pdf|docx"}
```{python}
print("This is in PDF or docx")
```
::: |
Beta Was this translation helpful? Give feedback.
Answered by
SamEdwardes
Nov 4, 2024
Replies: 2 comments 9 replies
-
Don't combine the values, add any number of when/unless statements. |
Beta Was this translation helpful? Give feedback.
9 replies
-
from @mcanouil:
This should now work:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
SamEdwardes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from @mcanouil:
This should now work: