Improve validation for layout to help distill conversion ?

Đang mở
#2,013 8 bình luận 0 reaction 2 người được giao Xem trên GitHub

@cderv đang làm issue này rồi.

Từ ngày 15/11/2022.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

enhancement yaml-validation
Bug description

distill has also a layout option, and for now if the option is not correctly converted to Quarto supported one then there is an useful error

  • Content from distill without using YAML syntax
---
title: "A small example"
format: html
page-layout: article
---

```{r setup, layout="l-body-outset"}
mtcars[,1:3] |> head()
```
  • After conversion using knitr::convert_chunk_header()
---
title: "A small example"
format: html
page-layout: article
---

```{r}
#| layout: l-body-outset
mtcars[,1:3] |> head()
```

in both case, we'll have this issue

Error running filter C:/Users/chris/scoop/apps/quarto-prerelease/current/share/filters/layout/layout.lua:
...prerelease\current\bin\..\share\pandoc\datadir\_json.lua:167: bad 'for' initial value (number expected, got nil)
stack traceback:
	...prerelease\current\bin\..\share\pandoc\datadir\_json.lua:381: in function '_json.decode'
	...uarto-prerelease/current/share/filters/layout/layout.lua:3641: in function 'parseLayoutWidths'
	...uarto-prerelease/current/share/filters/layout/layout.lua:4274: in function 'layoutCells'
	...uarto-prerelease/current/share/filters/layout/layout.lua:4098: in function <...uarto-prerelease/current/share/filters/layout/layout.lua:4091>
ERROR: unexpected character 'l' at line 1 col 1

Not so useful.
And in the second case, YAML validation does not help to detect that. No error detected for the layout field in the chunk for me.

Can we do better in the error or at least in the validation ?

quarto check Output
$ quarto check

[>] Checking Quarto installation......OK
      Version: 1.1.80
      Path: C:\Users\chris\scoop\apps\quarto-prerelease\current\bin\
      CodePage: unknown

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

[>] Checking Python 3 installation....OK
      Version: 3.9.13
      Path: C:/Users/chris/scoop/apps/pyenv/current/pyenv-win/versions/3.9.13/python3.exe
      Jupyter: 4.11.1
      Kernels: bash, julia-1.7, python3

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

(\) Checking R installation...........++ Activating rlang global_entrace

++ Setting QUARTO_PYTHON

[>] Checking R installation...........OK
      Version: 4.2.0
      Path: C:/PROGRA~1/R/R-42~1.0
      LibPaths:
        - C:/Users/chris/AppData/Local/R/win-library/4.2
        - C:/Program Files/R/R-4.2.0/library
      rmarkdown: 2.14.3

[>] Checking Knitr engine render......OK
Ngôn ngữ chính
JavaScript
Star
6k
Fork
458
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
41

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/quarto-cli

Tất cả issue của quarto-dev/quarto-cli

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.