Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto Apto para principiantes
#1,211 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript, vscode
Área
devtools

Línea de trabajo

El issue apunta a la extracción matemática de reserva de Quarto Language Server en apps/vscode / out/lsp/lsp.js. Lee el orden de coincidencia de las regex y comprueba cómo recibe texto extraído la vista previa de Equation assist; prueba el ejemplo de matemáticas en modo display de una sola línea del issue. Se considera terminado cuando las matemáticas en modo display aparecen en la vista previa sin signos de dólar y las matemáticas en línea siguen renderizándose correctamente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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);
    
Lenguaje dominante
TypeScript
Estrellas
655
Forks
64
Merge medio
20 h 53 min
PR fusionados (30 d)
46

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de quarto-dev/quarto

Todos los issues de quarto-dev/quarto

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.