Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Parse link references without knowledge of definitions

オープン
#702 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
markdown
領域
documentation

調査の方向性

Start with CommonMark specification Example 568 and the issue's discussion of reference definitions, streamed parsing, and syntax highlighting. Determine whether the proposed parsing behavior is an accepted specification change; done would require a maintainer decision and, if accepted, corresponding specification and reference-test updates.

索引モデルが issue の本文から書いたものです。

説明

Heya, I would like to understand the rationale behind https://spec.commonmark.org/0.30/#example-568

[foo][bar][baz]

[baz]: /url
<p>[foo]<a href="/url">bar</a></p>

This enforces on both users and parsers that [foo][bar][baz] cannot be "understood" in isolation, but only after all definitions within the document have been identified.

Particularly for parsers (such as markdown-it and remark), this necessitates a bunch of extra complexity to run a "pre-parse", before one can actually parse the document in full.
In turn, it precludes any kind of streamed or incremental parsing, or to write a good regex based syntax highlighter (such as TextMate grammars)

I feel the output of this example should be:

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

or even just

<p><a href="/url">baz</a></p>

i.e.

  1. There would be a full parse, during which both [foo][bar] and [baz] are captured as link references in the AST.
  2. During this parse all definitions are also captured
  3. On conversion to HTML, when encountering the [foo][bar] link reference, with no matched definition, it would be output in its raw (encoded) format, or even just omitted.

Is there any rationale to Example 568 that I am missing?


In fact, the syntax highlighting, here on GitHub, demonstrates exactly the problem, in that it cannot "work out" what is a link reference, and incorrectly highlights [foo]:

image
主要言語
Python
スター
5.2k
フォーク
360
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

commonmark/commonmark-spec のほかの issue

commonmark/commonmark-spec の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。