qmd-syntax-helper: Pandoc-based rules lose reference links and footnotes that depend on the rest of the document

オープン 初心者向け
#1,435 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
markdown, rust

調査の方向性

Issueでは、移行ガイドでの警告と、qmd-syntax-helperの出力に含まれるエスケープされた角括弧の並びに対する任意の警告が提案されています。ファイルやテストは指定されていません。まず移行ガイドとhelperの出力処理を探し、次にそのルールが変換結果をどのように報告するかを確認してください。ガイドで、影響を受けるブロック内の参照と脚注は変換前に変換する必要があると説明され、出力で確認が必要なエスケープされた角括弧を警告できるようになれば完了です。

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

説明

Some qmd-syntax-helper rules (definition-lists, and grid-tables when it produces list tables) pass the construct they convert through Pandoc and write it back from Pandoc's AST. Pandoc only sees the construct itself, not the rest of the document. Markup inside it that depends on something elsewhere in the document therefore cannot be resolved: reference-style links and their [label]: url definitions, and footnote references with their [^n]: ... definitions. That markup is written back as escaped literal text (\[the manual\]\[docs\], \[\^1\]), and the link or footnote is silently lost.

Running the rules in the other order does not help. Before conversion, q2 reads a Pandoc definition list as literal text, so the reference-links rule cannot see uses inside it. It then treats their definitions as unused and removes them. Either way, the URL for a reference link inside a definition list disappears from the document. It can only be recovered from version control. I don't think this can be prevented in general: the construct has to be converted before its contents are visible to q2, and converting it is what strips the context. But the migration guide should warn about it. The helper could also flag its own output when it contains escaped \]\[ or \[\^ sequences, so these cases get a manual look.

Example
Some prose with a [working link][docs].

Term
:   A definition that cites [the manual][docs]
    and has a footnote[^1].

[docs]: https://example.com/docs

[^1]: The footnote text.

Pandoc renders both links and the footnote. After qmd-syntax-helper convert -r definition-lists -i:

Some prose with a [working link][docs].

::: {.definition-list}

* Term

  * A definition that cites \[the manual\]\[docs\]
    and has a footnote\[\^1\].

:::
[docs]: https://example.com/docs

[^1]: The footnote text.

and then after -r reference-links:

Some prose with a [working link](https://example.com/docs).

::: {.definition-list}

* Term

  * A definition that cites \[the manual\]\[docs\]
    and has a footnote\[\^1\].

:::

[^1]: The footnote text.

The link inside the definition is now literal text, and its URL is gone. The footnote reference is literal and its definition is orphaned. Running reference-links first and definition-lists second ends in the same state: the use inside the definition list is not seen, so [docs]: is removed in the first step.

A suggested sentence for the migration guide: before converting definition lists or grid tables, convert any reference-style links and footnotes inside them to inline form by hand ([text](url), ^[note]). Afterwards, review the converted blocks for escaped brackets.

qmd-syntax-helper 0.1.0, pandoc 3.13.

主要言語
Rust
スター
321
フォーク
23
平均マージ
11時間 39分
マージ済み PR(30日)
251

環境構築

はじめの一歩

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

quarto-dev/q2 のほかの issue

quarto-dev/q2 の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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