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

[VS Code] Single-line display math ($$...$$) renders with literal dollar signs in "Quarto: Equation" assist preview

Đang mở Phù hợp với người mới
#1,211 0 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript, vscode
Lĩnh vực
devtools

Hướng nghiên cứu

Issue đề cập đến phần trích xuất toán học dự phòng của Quarto Language Server trong apps/vscode / out/lsp/lsp.js. Đọc thứ tự khớp regex và kiểm tra cách phần xem trước của Equation assist nhận văn bản đã trích xuất; thử ví dụ toán hiển thị trên một dòng trong issue. Hoàn tất khi toán hiển thị được xem trước mà không có dấu đô la và toán inline vẫn hiển thị đúng.

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

Mô tả

bug
Bug description

When the cursor is positioned on a single-line display math equation (e.g., $$ y = mx + q $$), the Quarto: Equation assist panel renders the equation with spurious literal dollar signs at both ends:
$y = mx + q$

In contrast, standard inline math on a single dollar delimiter (e.g., $y = mx + q$) renders cleanly without any dollar signs.

Steps to reproduce
  1. Open a .qmd document in VS Code with the Quarto extension installed and enabled.
  2. Type a display math equation on a single line, for example:
    $$ y + 0.900 = 9.638 x^{-1.394} $$
    
  3. Place the cursor anywhere within or on that line.
  4. Inspect the Quarto: Equation assist panel in the sidebar/panel.
Actual behavior

The equation preview in the Quarto: Equation panel renders with visible dollar symbols:
$y + 0.900 = 9.638 x^{-1.394}$

Expected behavior

The equation preview should render cleanly without leading or trailing dollar signs:
y + 0.900 = 9.638 x^{-1.394}

Your environment

vscode
ubuntu

Root Cause Analysis

In the Quarto Language Server (apps/vscode / out/lsp/lsp.js), the fallback math extraction function for the current line evaluates the inline math regex before the display math regex:

return findMatch(pos, line, inlineRegex) || findMatch(pos, line, displayRegex);

Where:

  • inlineRegex: /\$([^ ].*?[^ ]?)\$/g
  • displayRegex: /\$\$([^\n]+?)\$\$/

When scanning a line containing single-line display math like $$ y + 0.900 = 9.638 x^{-1.394} $$:

  1. The inline regex (inlineRegex) matches first.
  2. The 1st $ satisfies the opening delimiter \$.
  3. The 2nd $ (not being whitespace [^ ]) is treated as the start of the formula text group ([^ ].*?[^ ]?).
  4. The 3rd $ satisfies the closing delimiter \$.
  5. The extracted string passed to the MathJax renderer is $ y + 0.900 = 9.638 x^{-1.394} $.
  6. MathJax renders the unstripped dollar signs as literal text.

Suggested Fix
  1. Evaluate displayRegex before inlineRegex:
    return findMatch(pos, line, displayRegex) || findMatch(pos, line, inlineRegex);
    
Ngôn ngữ chính
TypeScript
Star
655
Fork
64
Merge trung bình
20 giờ 53 phút
Pull request đã merge (30 ngày)
46

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.