Ordinary JSON is silently discarded when it mentions notebook format markers
Maintainer thường phản hồi trong vòng 1 ngày
@CHX606 đang làm issue này rồi.
Từ ngày 1/11/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start in IpynbConverter.accepts(), which currently matches the nbformat and nbformat_minor substrings in the decoded text, and in _convert(), which treats a missing top-level cells as an empty list. Done means ordinary JSON that only mentions those markers is preserved as text, while genuine notebooks still convert with and without a UTF-8 BOM and the stream position is kept. Pull request #2805 already targets this, so check it before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Ordinary JSON is silently converted to empty Markdown when it mentions both nbformat and nbformat_minor, even when those words occur only inside a string value or a nested example.
IpynbConverter.accepts() currently checks for those substrings in the decoded text. Once it accepts the input, _convert() reads a missing top-level cells as an empty list and returns an empty successful conversion, so the plain-text converter never preserves the original JSON.
Reproduction with MarkItDown 0.1.9 on main at 7482c092d9c0074a89803c9fdb63a969e7fe17fc, Windows 11 / Python 3.12:
import io
import json
from markitdown import MarkItDown, StreamInfo
payload = {
"description": "The format uses nbformat and nbformat_minor fields.",
"items": ["important content"],
}
content = json.dumps(payload)
result = MarkItDown().convert_stream(
io.BytesIO(content.encode("utf-8")),
stream_info=StreamInfo(
extension=".json", mimetype="application/json", charset="utf-8"
),
)
print(repr(result.markdown))
Actual output: ''.
Expected: the JSON text is preserved, as for other ordinary JSON documents.
This also reproduces with {"nbformat": 4, "nbformat_minor": 5, "data": ["important content"]} and with a notebook-shaped object nested under an example key.
A focused fix can decode the candidate JSON and require the notebook markers and a cells list at the top level. It should preserve .ipynb extension routing, genuine MIME-detected notebooks (including a UTF-8 BOM), and the stream position. Malformed or excessively nested JSON should be declined rather than crash detection.
Local regression results on the untouched implementation: 4 failed, 2 passed. The failing cases cover the three ordinary-JSON examples and rejection of a deeply nested non-notebook value. The two controls confirm genuine notebooks still convert with and without a BOM.
AI assistance: Codex identified the issue, executed the reproduction and regression tests, and prepared this report on behalf of the account owner.
- Ngôn ngữ chính
- Python
- Star
- 194k
- Fork
- 14.5k
- Merge trung bình
- 22 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
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.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/markitdown
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 89/100
microsoft/markitdown#2834 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
URL fetch sends default python-requests User-Agent, Wikipedia returns 403Có thể đã có người làm @sushan5140 đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/markitdown#2820 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Valid Atom feeds with zero entries are rejected as an unknown feed typeCó thể đã có người làm @pujitha24 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/markitdown#2781 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DOCX: footnote references and back-links point to anchors that don't exist in the MarkdownCó thể đã có người làm @sun04222 đã nhận 13 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/markitdown#2743 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DOCX math: a delimiter with several arguments keeps only the last oneCó thể đã có người làm @drakeo338 đã nhận 35 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
microsoft/markitdown#2573 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/markitdown
Issue tương tự
-
area/test type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Clodmony/starship-coop#70 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
punitarani/fli#270 ·
-
🐛 Bug 🔔 Pending processing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
jumpserver/jumpserver#17980 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Claiming namespace `prodmetrics`Đang mởnamespace
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
EclipseFdn/open-vsx.org#15341 ·
Maintainer thường phản hồi trong vòng 1 ngày