Syntax highlighting for zsh code blocks doesn’t work in visual editor for quarto document.

‘shell’ block syntax is recognised, but ‘zsh’ isn’t.

I’ve tried to attach a screen shot - it hasn’t worked so I’ll just post the code blocks.

```{shell}
export A=1
```

```{zsh}
export A=1
```

The code runs in both cases - although even though I’ve set my environment up such that ’shell’ points to zsh the code in the shell block is still executed by sh (GNU bash, version 3.2.57), not zsh.

Session Info:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.7.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] quarto_1.3 knitr_1.39

loaded via a namespace (and not attached):
[1] Rcpp_1.0.11 ps_1.7.5 digest_0.6.33 later_1.3.1 jsonlite_1.8.7
[6] evaluate_0.22 rlang_1.1.2 cli_3.6.2 rstudioapi_0.15.0 rmarkdown_2.25
[11] tools_4.2.1 yaml_2.3.7 xfun_0.40 fastmap_1.1.1 compiler_4.2.1
[16] processx_3.8.2 htmltools_0.5.6.1

RStudio Version:
2022.07.2 Build 576

(Doesn’t work in Version 2023.09.1+494 (2023.09.1+494) either)

© 2009-2022 RStudio, PBC

"Spotted Wakerobin" Release (e7373ef8, 2022-09-06) for macOS

Mozilla/5.0 (Macintosh; Intel Mac OS X 12_7_1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

pandoc version: pandoc 3.1.11

quarto version: 1.3.340

zsh version: zsh 5.8.1 (x86_64-apple-darwin21.0)

highlight version 4.10

Sorry I am not sure I am following. What is the issue encountered here ?

Highlighting in VSCODE ? RStudio IDE visual editor mode ?

Or something else ?

Thanks

Hi cderv.

Thanks for responding.

The problem is in RStudio IDE visual editor.

Really there 2 problems:

  1. zsh syntax is not recognised within a {zsh} block. There is no highlighting applied.

  2. If a {shell} block is defined then RStudio looks for a ‘shell’ binary in the $PATH (I guess). Even if I set up a shell binary that is found, and is in fact a link or actual copy of zsh binary, RStudio uses ‘sh’ to execute the code block, not the ‘shell’ binary that is found in the path.

When using {shell} block the code is highlighted OK (as bash - but close enough).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

Then this is an issue for GitHub - quarto-dev/quarto: Quarto open-source scientific and technical publishing system
you can report there is not already - it probably means the Quarto extension needs somehow to be teach about this language alias

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.