quarto-dev / quarto-dev/quarto-cli

YAML Validation fails for specifying filter process positions in extensions outside of formats

Open
#11,560 1 comment 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Nov 28, 2024.

enhancement extensions lua yaml-validation
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

From More precise targeting of AST processing phases in Quarto v1.4 pre-release, there are different injection points for Lua filters. I'm in need of a filter that intercepts the format or main meta data in advance of Quarto creating the website/html envelope so that I can sneak links into the right hand side menu bar.

However, I'm running into an error with respect to packaging the new targets, specifically we have:

title: Astdemo
author: JJB
version: 1.0.0
quarto-required: ">=1.6.0"
contributes:
  filters:
    - at: pre-ast
      path: astdemo.lua

Causing on quarto preview:

ERROR: YAML Validation Failed

In file _extensions/astdemo/_extension.yml
(line 7, column 7 through line 8, column 23) Array entry 1 with value at: pre-ast
  path: astdemo.lua failed to be a string.
6:   filters:
7:     - at: pre-ast
        ~~~~~~~~~~~~
8:       path: astdemo.lua
  ~~~~~~~~~~~~~~~~~~~~~~~
✖ The value

at: pre-ast
  path: astdemo.lua

is of type object.
ℹ The error happened in location contributes:filters:0.

A quick grep on existing code extensions just turns up apaquarto, which has this specification under contributes.formats.common and subsequently under more specific format outputs, e.g. contributes.formats.html et cetera:

title: My Document in APA Style, Seventh Edition
author: W. Joel Schneider
version: 4.3.6
quarto-required: ">=1.4.549"
contributes:
  formats:
    common:
      execute:
        echo: false
      citeproc: false
      link-citations: true
      # .... suppressed more
      filters:
        - at: pre-ast
          path: apalanguage.lua
        - at: pre-ast
      # .... suppressed more
Steps to reproduce

Please see the extension code in https://github.com/coatless-quarto/filter-processing

This is just the default template with the above _extension.yml modification.

Expected behavior

I'd expect to be able to use the filter outside of the format.

Actual behavior

The filter must be placed under a new format.

Your environment
  • IDE: VS Code 1.95.3
  • OS: macOS 15.1.1 (24B91)
Quarto check output
Quarto 1.6.39
[✓] Checking environment information...
      Quarto cache location: /Users/ronin/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.39
      Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /opt/homebrew/bin
      Version: undefined

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.10
      Path: /Users/ronin/.pyenv/versions/3.11.10/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.4.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.49
      rmarkdown: 2.29

[✓] 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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.