quarto-dev / quarto-dev/quarto-cli

Bad shortcode syntax on a page breaks variable substitution

Open
#7,975 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement lint
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

Good shortcode: {{< shortcode >}}
Bad shortcode: {{< shortcode > }} notice the space after >.

If:

  1. A project title (in _quarto.yml) contains a variable from _variables.yml
  2. A page has a bad shortcode syntax (not necessarily a var shortcode)

then the project title in the header of that (2.) page will not be processed.

The same is true if using an environment variable in the _environment file.

Steps to reproduce
  1. Create a quarto project.
  2. Add the "bad" shortcode to a page.
  3. Create variables file
  4. Change project title to a var value
  5. Render
  6. Check the rendered title

On macos

quarto create project website . --no-prompt;
echo "{{< shortcode > }}" >> index.qmd;
echo "version: 1.2.3" >> _variables.yml;
sed -i '' -e 's/  title: "."/  title: "{{< var version >}}"/' _quarto.yml;  # macos sed
quarto render;
grep "navbar-title" _site/index.html

Alternatively, on linux

quarto create project website . --no-prompt;
echo "{{< shortcode > }}" >> index.qmd;
echo "version: 1.2.3" >> _variables.yml;
sed -i 's/  title: "."/  title: "{{< var version >}}"/' _quarto.yml;  # gnu sed
quarto render;
grep "navbar-title" _site/index.html
Expected behavior
    <span class="navbar-title">1.2.3</span>
Actual behavior
    <span class="navbar-title">{{&lt; var version &gt;}}</span>
Your environment
  • OS: macOS Sonoma 14.1.1
Quarto check output
Quarto 1.4.530
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.530
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2022.11
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/hassan/Library/TinyTeX/bin/universal-darwin
      Version: 2022

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.4
      Path: /Users/hassan/.pyenv/versions/plotnine/bin/python3
      Jupyter: 5.5.0
      Kernels: gnuplot, python3

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

[✓] Checking R installation...........OK
      Version: 4.2.3
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.2/Resources/library
      knitr: 1.43
      rmarkdown: 2.21

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

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.

Research direction

Run the provided macOS or Linux reproduction using _quarto.yml, index.qmd, and _variables.yml, then compare the rendered navbar-title with the expected 1.2.3 value. Trace how the malformed shortcode in index.qmd is handled before variable substitution and rendering; done means the project title is substituted correctly despite the bad shortcode syntax, including when using _environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.