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

Restrict content after shortcut reference

Abierto
#653 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript

Línea de trabajo

Start with the CommonMark shortcut reference and link label sections cited in the issue, then compare the supplied Markdown and HTML examples. The work is done when one of the proposed rules is decided and the specification and corresponding examples consistently document that behavior.

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

Descripción

Proposal

The spec has this to say on shortcut references:

A shortcut reference link consists of a link label that matches a link reference definition elsewhere in the document and is not followed by [] or a link label.

…and a link label is defined as:

A link label begins with a left bracket ([) and ends with the first right bracket (]) that is not backslash-escaped. Between these brackets there must be at least one non-whitespace character.

(emphasis mine)

I propose tightening what can follow a shortcut reference, to:

-followed by `[]` or a link label.
+followed by `[`.
Problem

The reason for that is that while this restriction has been there since roughly the start (GH-322), almost all CM parsers, including commonmark.js, do not implement this rule correctly, as when given:

[x]: /url

[x][ ], [x][	], [x][
], [x][]

They (normalized) produce:

<p>
  [x][ ], [x][	], [x][ ], <a href="/url">x</a>
</p>

Whereas, according to the current rules, the following should be produced:

<p>
  <a href="/url">x</a>[ ], <a href="/url">x</a>[	], <a href="/url">x</a>[ ], <a href="/url">x</a>
</p>

I kinda like the actual behavior, I think it makes more sense, changing the spec would match it.

Solutions
  1. Implement this proposal in the spec
  2. Alternatively, allow whitespace in collapsed references.
  3. Alternatively, fix commonmark.js / other implementations
Lenguaje dominante
Python
Estrellas
5.2k
Forks
360
Métricas de merge de PR
Sin PR fusionados en 30 d

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 commonmark/commonmark-spec

Todos los issues de commonmark/commonmark-spec

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.