Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Typst grammar bug leaves string scope unclosed, breaking highlighting in code blocks and `.typ` files

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

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
vscode
Lĩnh vực
devtools, tooling

Hướng nghiên cứu

Start with Quarto's Typst TextMate grammar and reproduce the leak in the supplied test.qmd example and a standalone test.typ file with the Quarto extension enabled. Determine how strings containing # inside #context are scoped and how the grammar is injected into source.typst. Done means the closing quote ends the string scope and standalone Typst highlighting no longer conflicts with native tooling.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Bug description

Quarto's Typst TextMate grammar has a parsing bug: it fails to recognize the closing quote of a string if it contains a # inside a #context block.

Impact on standalone .typ files:
Because Quarto injects this grammar globally into source.typst, this exact same bug completely breaks the syntax highlighting for standalone .typ files as well, overriding dedicated extensions like Tinymist.

Steps to reproduce
  1. Create a test.qmd file.
  2. Paste the following code:
```typst
#context {
  let c = rgb("#8C6A48")
}

= Heading
Text
```

(Note: The exact same issue can be reproduced in a standalone test.typ file with the Quarto extension enabled.)

Actual behavior

Everything after "#8C6A48" (including = Heading and Text) is incorrectly highlighted as a string because the scope never closes.

Inside a .qmd file, the markdown code fence barely contains the leak. However, in a standalone .typ file (which has no markdown fences), this single bug breaks the syntax highlighting for the entire rest of the file down to EOF.

Expected behavior
  1. The Typst grammar should correctly recognize the closing quote of strings containing # and close the string scope.
  2. Quarto's Typst grammar injection should ideally be restricted to .qmd/.md files, or there should be an opt-out setting for standalone .typ files to prevent global conflicts with native Typst tooling.
Your environment
  • IDE: VSCode v1.130.0
  • Quarto Extension: v1.135.0
  • Tinymist Extension: v0.15.2
  • OS: Windows 11
Ngôn ngữ chính
TypeScript
Star
652
Fork
64
Merge trung bình
8 giờ 45 phút
Pull request đã merge (30 ngày)
36

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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

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

Issue tương tự

Thêm issue về TypeScript

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.