CommonMark spec gaps grouped by root cause, and a question about lookup tables

Abierto
#4,050 21 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
javascript, markdown

Línea de trabajo

Empieza por update-specs.js y vuelve a ejecutar la suite de especificaciones de CommonMark con los casos shouldFail indicados para confirmar el snapshot. Antes de cambiar el código, obtén una decisión de un maintainer sobre si las tablas de búsqueda son aceptables dentro de la huella sin dependencias. Se considera terminado cuando haya una implementación aceptada que resuelva los casos elegidos o una decisión documentada de mantenerlos como brechas conocidas.

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

Descripción

I ran the spec suite on main (18.0.9, 681373c) and went through the cases carrying shouldFail to see what is actually left. Since update-specs.js sets that flag from whatever fails at the time it runs, the set is a snapshot of current behavior rather than a list of decisions, so I grouped it by root cause. Posting it in case it is useful for triage, and because two of the groups run into the same wall and that seems worth asking about before anyone starts on them.

CommonMark 0.31.2, gfm: false, 15 cases:

Root cause Examples Count
Character references in link destination and title 32, 33, 503 3
Nested brackets in link text 512, 518, 519, 520, 528, 532, 533 7
Raw HTML and autolinks taking precedence over links 524, 526, 536, 538 4
Unicode case folding of link labels 540 1

Running the same file with gfm: true flags 4 more (602, 608, 611, 612), but those look like the autolink extension doing its job against a spec file written before it existed. For instance 611 expects https://example.com to stay plain text and marked links it, which is what GFM asks for. I would not count those as gaps.

gfm.0.29 has 4: 633, 634 and 635 are mailto: and xmpp: autolinks, 657 is the disallowed raw HTML filter.

The wall

The two smallest groups look approachable until you try them, and both need a lookup table, which sits badly with marked having no runtime dependencies.

Character references, current output on the left:

[foo](/föö "föö")
  <p><a href="/f&ouml;&ouml;" title="f&ouml;&ouml;">foo</a></p>
  <p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p>

[link](foo%20b&auml;)
  <p><a href="foo%20b&auml;">link</a></p>
  <p><a href="foo%20b%C3%A4">link</a></p>

Leaving the entity in place works for text content because the browser resolves it, but a destination has to be decoded first and then percent encoded, and getting there means the HTML5 named reference table.

Case folding is the same shape. Example 540 wants [ẞ] to match [SS], which needs full folding to ss. I tried the usual shortcuts and neither gets there:

'ẞ'.toLowerCase()                    // 'ß'
'SS'.toLowerCase()                   // 'ss'
'ẞ'.toUpperCase().toLowerCase()      // 'ß'

The question

Would you take a PR that adds a table for either of these, and if so is there a size budget worth knowing about? Or would you rather they stay as known gaps and keep the dependency-free footprint as it is?

Happy to do the work on whichever you would accept. If the answer is neither, that is a useful answer too, and it might be worth a note somewhere so the next person does not rediscover it.

Lenguaje dominante
TypeScript
Estrellas
37.3k
Forks
3.9k
Merge medio
5 d 6 h
PR fusionados (30 d)
62

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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 markedjs/marked

Todos los issues de markedjs/marked

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.