MarkdownReader throws NotSupportedException on task lists (- [ ])

Đang mở Phù hợp với người mới
#7,982 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Laurianti đang làm issue này rồi.

Từ ngày 25/11/2026.

  • #7983 của @Laurianti — đang mở
  • #7994 của @luisquintanilla — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu tại MarkdownParser.GetText, nơi issue báo rằng TaskList rơi vào NotSupportedException; lần theo cách các khối danh sách và phần tử inline được ánh xạ. Kiểm tra các bài kiểm thử MarkdownParser hiện có về xử lý danh sách và bổ sung kiểm thử cho các mục tác vụ chưa đánh dấu và đã đánh dấu, giữ nguyên dấu đánh dấu của chúng dưới dạng văn bản. Công việc hoàn tất khi MarkdownReader đọc tài liệu ví dụ mà không phát sinh ngoại lệ và tạo ra các phần tử danh sách.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area-ai untriaged
Description

MarkdownReader throws a NotSupportedException on any Markdown that contains a task list (- [ ] / - [x]), so the whole document cannot be read.

MarkdownParser builds its pipeline with UseAdvancedExtensions(), which enables Markdig's task list extension, but MarkdownParser.GetText has no case for the resulting TaskList inline and falls through to throw new NotSupportedException($"Inline type '{inline.GetType().Name}' is not supported.").

Reproduction Steps
<PackageReference Include="Microsoft.Extensions.DataIngestion.Markdig" Version="10.11.1-preview.1.26569.2" />
using System.Text;
using Microsoft.Extensions.DataIngestion;

string markdown = """
    # Checklist

    - [ ] first task
    - [x] second task
    """;

using MemoryStream stream = new(Encoding.UTF8.GetBytes(markdown));
IngestionDocument document = await new MarkdownReader().ReadAsync(stream, "checklist.md", "text/markdown");
Console.WriteLine($"{document.EnumerateContent().Count()} elements");
Expected behavior

The document is read; the task list items become list elements, for example with their [ ] / [x] marker kept as text.

Actual behavior
System.NotSupportedException: Inline type 'TaskList' is not supported.
   at Microsoft.Extensions.DataIngestion.MarkdownParser.GetText(ContainerInline containerInline)
   at Microsoft.Extensions.DataIngestion.MarkdownParser.MapLeafBlockToElement(LeafBlock block, Boolean previousWasBreak, String elementMarkdown)
   at Microsoft.Extensions.DataIngestion.MarkdownParser.MapListBlock(ListBlock listBlock, Boolean previousWasBreak, String documentMarkdown, String listMarkdown)
   at Microsoft.Extensions.DataIngestion.MarkdownParser.MapBlock(String documentMarkdown, Boolean previousWasBreak, Block block)
   at Microsoft.Extensions.DataIngestion.MarkdownParser.Map(MarkdownDocument markdownDocument, String documentMarkdown, String identifier)
Regression?

Not known.

Known Workarounds

Removing the [ ] / [x] markers from the text before reading it.

Configuration
  • Microsoft.Extensions.DataIngestion.Markdig 10.11.1-preview.1.26569.2
  • .NET 10, Windows x64
  • The pipeline is not configurable from MarkdownReader, so the extension cannot be turned off by the caller.
Other information

Task lists are common in documentation pages (checklists, to-do sections); in a set of 145 real documentation pages, several could not be read for this reason.

Ngôn ngữ chính
C#
Star
3.3k
Fork
928
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của dotnet/extensions

Tất cả issue của dotnet/extensions

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.