Serializer keeps a link open across a whitespace-only marked node

Abierto
#1,263 1 comentario 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
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
70/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
tooling

Línea de trabajo

Start in MarkdownSerializerState.renderInline and the expelEnclosingWhitespace step it relies on, since the issue traces the bug to renderInline setting marks = active for a whitespace-only marked node. Reproduce with the BaseSchemaSpecs, LinkSpecs and BoldSpecs setup from the issue and confirm the output drops the autolink. Done means the link is closed before the space is written, the serializer test prints the autolink followed by text, and a parsing regression test covers the round trip.

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

Descripción

bug

MarkdownSerializerState.renderInline keeps the previous link active when the next node contains only marked whitespace.

Reproduce with BaseSchemaSpecs, LinkSpecs and BoldSpecs:

const href = 'https://ya.ru/';
const content = doc(p(a({href}, href), bold(' '), 'text'));

serializer.serialize(content);

Expected:

<https://ya.ru/> text

Actual:

<https://ya.ru/ >text

The result is not a valid autolink. After parsing, < and > become visible text.

When expelEnclosingWhitespace removes all text from the bold node, renderInline sets marks = active. This keeps the previous link open while writing the space, although the original space node has no link mark.

Close marks absent from the original node before writing its whitespace. Add regression tests for serialization and parsing.

Lenguaje dominante
TypeScript
Estrellas
428
Forks
48
Merge medio
5 d 15 h
PR fusionados (30 d)
47

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 gravity-ui/markdown-editor

Todos los issues de gravity-ui/markdown-editor

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.