Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_variable.yml variables that contain arbitrary markdown are treated as strings #4624

Closed
4 tasks done
longapalooza opened this issue Mar 4, 2023 · 2 comments · Fixed by quarto-dev/quarto-web#1203
Closed
4 tasks done
Assignees
Labels
documentation Doc improvements & quarto-web enhancement New feature or request
Milestone

Comments

@longapalooza
Copy link

longapalooza commented Mar 4, 2023

Bug description

Variables in my _variable.yml file that are arbitrary markdown content are not interpreted as markdown when my .qmd file is rendered. The variable behaves as a simple string. My .qmd file is shown below.

---
title: Test
---

:::{.content-hidden when-format="revealjs"}

My content for HTML


{{< var slide.open >}}
My content for revealjs
{{< var slide.close >}}

My other content for HTML

:::

My _variable.yml has the following keys

slide:
    open: |
        :::
        :::{.content-visible when-format="revealjs"}
    close: |
        :::
        :::{.content-hidden when-format="revealjs"}

The rendered output looks like

Test
MODIFIED
Fr 2023-03-03 22:01

My content for HTML

::: :::{.content-visible when-format=“revealjs”}

My content for revealjs

::: :::{.content-hidden when-format=“revealjs”}

My other content for HTML

Is this the intended behavior? I've tried some other arbitrary markdown (e.g., **) and have yet to be successful. The documentation leads me to believe that any arbitrary markdown may be used, but that doesn't seem to be the case. Using links as provided in the example in the documentation seems to work, though.

I'm using Windows 10 with the 2022.12.0 Build 353 of RStudio, and the 1.3.208 version of quarto.

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.
@longapalooza longapalooza added the bug Something isn't working label Mar 4, 2023
@cscheid
Copy link
Collaborator

cscheid commented Mar 8, 2023

Ok, I know what the issue is. When we say "arbitrary markdown", we expect the content itself to be well-formed markdown. You're attempting to add content that when spliced into the markdown, yields valid markdown, but the problem is that the content itself changes the markup around it (you're attempting to close the previous div and open a new one).

We should clarify this distinction in the documentation, but we don't support that on purpose (and this isn't a bug), because it would make parsing the document impossible in general, since your var content could arbitrarily change the structure of the document.

I'm going to switch this to a documentation enhancement.

@cscheid cscheid added documentation Doc improvements & quarto-web enhancement New feature or request and removed bug Something isn't working labels Mar 8, 2023
@cscheid cscheid added this to the v1.4 milestone Mar 8, 2023
@longapalooza
Copy link
Author

Good deal. I figured it wasn't a bug, and I was just misunderstanding something. I appreciate the clarification.

I'd like to say that I recently just discovered Quarto, and it is pretty much exactly what I've been looking for for a while. I appreciate the hard work you all have put into developing it. So thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Doc improvements & quarto-web enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants