Letter, roman and `#.` list markers are read as paragraphs

未关闭
#1,028 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
compilers

调研方向

Start with crates/tree-sitter-qmd/tree-sitter-markdown/src/scanner.c, especially the scanner dispatch and parse_ordered_list_marker, then trace how crates/pampa/src/pandoc/treesitter_utils/list_marker.rs stores and parses markers. The issue leaves open whether q2 should support these markers or warn and document their absence, so clarify that decision first. Done means the chosen behavior is explicit and the reproduction no longer silently renders list markers as paragraphs.

由索引模型根据 Issue 内容生成。

描述

readers-writers
Bug description

Pandoc reads a), A., (i) and #. at the start of a line as ordered list markers (the fancy_lists extension).
Quarto 1 has it on by default, and writes ol type="a", ol type="A", ol type="i" or a plain ol.
q2 only accepts digits in front of . or ), so every other marker stays text, with no warning.

A q2 design note for the docx import work already records that qmd has no fancy list markers.
That work reports the lost list style and leaves the parser as it is, so the note does not say whether q2 plans to support these markers:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/claude-notes/plans/2026-10-03-document-import-epic.md?plain=1#L44

Nothing tells a user, and a Quarto 1 document changes meaning without an error.

The scanner sends a line to parse_ordered_list_marker only when it starts with a digit, and that function has no branch for letters, roman numerals or #:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/tree-sitter-qmd/tree-sitter-markdown/src/scanner.c#L1400-L1413

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/tree-sitter-qmd/tree-sitter-markdown/src/scanner.c#L3359-L3373

The marker is then stored as a number, and process_list_marker parses it as usize:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/pampa/src/pandoc/treesitter_utils/list_marker.rs#L25-L41

Steps to reproduce

index.qmd:

---
format: html
---

a) First

b) Second

Run q2 and Quarto 1 on it:

q2 render index.qmd --to html
quarto render index.qmd --to html
Actual behavior

q2 renders two paragraphs and the HTML has no ol:

<p>a) First</p>
<p>b) Second</p>

Quarto 1.12.0 renders an ordered list:

<ol type="a">
<li><p>First</p></li>
<li><p>Second</p></li>
</ol>
Expected behavior

The markers give ordered lists with the matching type attribute, as in Quarto 1.
If q2 does not plan to support these markers, the notes on differences from Quarto 1 could say so, and q2 could warn when a line starts with one of them.

Your environment
  • q2: Q2 (quarto 2) 0.40.0-nightly.20261101 (nightly built from a2a1cb9).
  • Quarto 1 for comparison: 1.12.0 (pre-release).
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
主要语言
Rust
星标
293
派生
20
平均合并
4 小时 53 分钟
30 天内合并 PR
203

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/q2 的其他 Issue

查看 quarto-dev/q2 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。