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

remend: unclosed `$$` in a table cell is closed on a new line when an earlier line has math

Abierto Apto para principiantes
#652 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@orinnz ya está trabajando en esto.

Desde el 3/10/2026.

  • #653 de @orinnz — abierto

Evaluación

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

Línea de trabajo

Empieza en packages/remend/src/katex-handler.ts, en addClosingKatex, y reproduce el ejemplo de celda de tabla del issue. Verifica la elección de cierre para un $$ sin cerrar después de matemáticas anteriores, incluidos los casos de matemáticas en bloque y en línea; está hecho cuando la fila final Force se cierra en la misma línea sin provocar una regresión en el cierre en una nueva línea para las matemáticas en bloque.

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

Descripción

Bug Description

addClosingKatex in packages/remend/src/katex-handler.ts picks between $$ and \n$$ by looking for a newline after the first $$ in the whole text (text.indexOf("$$")). It should look after the $$ that is still open. So once any earlier line has math, every later unclosed $$ gets closed with \n$$.

In a table cell that newline ends the row, and the cell shows $$F = ma as raw text until the closing $$ arrives. A table with a formula in every row hits this on each row after the first.

Steps to Reproduce
import remend from "remend";

remend(
  "| Quantity | Formula |\n| --- | --- |\n| Energy | $$E = mc^2$$ |\n| Force | $$F = ma",
);
Expected Behavior

The last row is closed on the same line:

| Force | $$F = ma$$
Actual Behavior

The last row is closed on a new line:

| Force | $$F = ma\n$$

Rendered with <Streamdown plugins={{ math }} isAnimating>, the Force cell shows the raw text $$F = ma.

Without the Energy row, the same input closes correctly on the same line. Any earlier $$ causes it, for example "text $$a$$\n\n| A | B |\n| - | - |\n| x | $$E" also gets \n$$.

Code Sample

A possible fix is to measure from the last $$, which is the open one when the pair count is odd:

const openIndex = text.lastIndexOf("$$");
const hasNewlineAfterStart =
  openIndex !== -1 && text.indexOf("\n", openIndex) !== -1;

I ran the current and patched versions of addClosingKatex on these inputs:

Input ends with indexOf (current) lastIndexOf
| Force | $$F = ma (row above has math) \n$$ $$
| x | $$E (earlier paragraph has math) \n$$ $$
$$\nx^2 + y (block math) \n$$ \n$$
Inline $$a$$ then $$b $$ $$
Streamdown Version

streamdown 2.7.0, remend 1.4.0. The handler is the same on main.

React Version

19.2.8

Node.js Version

24.19.0

Browser(s)

Any. It reproduces in remend alone.

Operating System

Windows 11

Additional Context

We work around it with a custom remend handler at priority 65 that closes $$ on the same line when the last line is a table row.

Related: #539 covers other partial states that flash during streaming.

Lenguaje dominante
TypeScript
Estrellas
5.7k
Forks
307
Merge medio
1 d 19 h
PR fusionados (30 d)
24

Preparar el entorno

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 vercel/streamdown

Todos los issues de vercel/streamdown

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.