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

Increase Precedence of shortcut link references over full and compact for defined link references

Abierto
#663 9 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
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
markdown

Línea de trabajo

Start with the linked discussion and the spec.txt sections for Examples 561 and 567, then compare their current and desired outputs. Review the footnote example as an additional precedence case. Done means the specification and relevant reference behavior consistently reflect the requested precedence without changing unresolved ambiguities.

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

Descripción

Followup to this discussion as well as yuin/goldmark#143. The idea is to give higher precedence to shortcut link references when they actually resolve to a link defined in the document, so as to give priority to the links as defined by the author, rather than to the rules for parsing the links references themselves. Where ambiguity cannot be resolved by link definitions, the precedence should be as before. Examples follow.

Example 561
[foo][bar]

[foo]: /url1
[bar]: /url2

Current output:

<p><a href="/url2">foo</a></p>

Desired output:

<p><a href="/url1">foo</a><a href="/url2">bar</a></p>

Reason: The author has made explicit definitions for the foo and bar links, so both should take precedence over [foo][bar], as it's more likely to reflect the author's intent.

Example 567
[foo][bar][baz]

[baz]: /url1
[foo]: /url2

Current output:

<p>[foo]<a href="/url1">bar</a></p>

Desired output:

<p><a href="/url2">foo</a><a href="/url1">bar</a></p>

Reason: The author has made explicit definitions for the baz and foo links but not bar, so [foo] and [bar] should take precedence over [bar][baz], as it's more likely to reflect the author's intent.

Footnote Example
Visit [Foo][^1].

  [Foo]: https://example.com/
  [^1]: But not really

Current output:

<p>Visit [Foo]<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>.</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>But not really <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>

Desired output:

<p>Visit <a href="https://example.com/">Foo</a><sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>.</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item"><p>But not really <a href="#fnref1" class="footnote-backref">↩︎</a></p>
</li>
</ol>
</section>

Reason: The author has made explicit definitions for both the [Foo] link and the [^1] footnote, so both should be rendered, rather than prioritizing [Foo][^1] as a full reference, especially since [^1] fails to resolve to a link at all. Again, the intention here is to better approximate the likely intent of the author. (I realize that CM does not define a footnote syntax, but I suspect it its CM's precedence rules that interfere with the expected footnote output.)

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.