#1641·DeepTutor

[Bug]:Fresh `.md` uploads open as a single page in Immersive Reading (v1.6.12)

Author: xiliangmCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbug

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

Since v1.6.12, every Markdown file I upload to Immersive Reading ingests as one section: the reader shows the title, a few lines, and then nothing to continue with. The rest of the document is unreachable. Materials I uploaded before the upgrade still read normally, and switching the parsing engine from the UI changes nothing.

This looks like fall-out from the .md extraction change in #1574 ("fix: use headings for uploaded Markdown outlines", merged 2026-09-26T19:21:32Z, first shipped in v1.6.12), whose fence tracking is already known to be broken in #1637 (open, filed 2026-09-29T00:44:34Z).

Environment

  • DeepTutor: v1.6.12 (please confirm against the reporter's install)
  • Install: pip install -U deeptutor / Docker ghcr.io/hkuds/deeptutor:latest
  • OS: Windows
  • Path: Immersive Reading, local .md upload

Steps to reproduce

  1. Upload a Markdown document with several ##/### headings and any fenced code block — a chat/notes export is enough. My file: 66,835 bytes, 743 lines, 433 non-blank lines, UTF-8 without BOM, LF endings, first line is an H1, code fences present.
  2. Open it in Immersive Reading.
  3. Expected: all sections, with a navigable outline. Actual: one page — the opening — a few lines, then nothing.
  4. Try every parsing engine offered in the UI: identical result (see below).

Evidence that this is a v1.6.12 regression

  • #1574 merged 2026-09-26T19:21:32Z; v1.6.12 published 2026-09-27T05:34:32Z.

  • Verified directly in the release sources: deeptutor/reading/extract.py at tag v1.6.11 has no Markdown branch at all (.md falls through to _extract_sections); at tag v1.6.12 the same function contains

    elif suffix in {".md", ".markdown"}: units, outline = split_markdown_by_headings(_shared_extract(source))

    and its module docstring gained the line "* Markdown — the shared extractor's text, cut at usable ATX headings and then at paragraph boundaries for long sections."

  • #1574 states "Existing content-hash materials are not reprocessed by this change" — which is exactly why pre-upgrade uploads still read fine while everything uploaded since is affected.

Why the engine switch cannot help

The .md branch never reaches a configurable parsing engine: it calls the shared text extractor and emits extractor="text". Whatever engine is selected in the UI is irrelevant for .md, so "try another engine" can never change the outcome. A UI hint here would save users a lot of guessing.

Suspected root cause

split_markdown_by_headings() as merged in #1574 tracks the fence by character only:

if not fence_marker:
    fence_marker = marker[0]
elif marker[0] == fence_marker:
    fence_marker = ""

so any line beginning with the fence character toggles the state. #1637 documents the consequences, including "a fence that also ran to the end of the document" and "Every later heading was swallowed". If the outline collapses to the first heading while units stay bounded (SECTION_HARD_CHARS = 4200, SECTION_TARGET_CHARS = 2800; #1574's test asserts <= 4200 per outline row) and the reader paginates by outline row, the visible result is exactly one page and a few lines.

Second question for the maintainers: the "<2 usable headings → flat fallback" path returns an empty stored outline (extraction.outline == ()) while units are still flat sections. Does the reader render only unit 1 when the stored outline is empty? If so, that path produces the same single-page symptom for any document the heading splitter rejects, independently of #1637.

Module(s) Affected

  • Other: deeptutor/reading (extract / ingestion) and the Immersive Reading reader pane
  • tests

Additional context

  • #1637 fixes one class of this. The "single page" symptom may still need its own check: a swallowed-heading outline is a different failure from a wrong outline title.
  • Probe for maintainers:
python -c "from deeptutor.reading.extract import extract_material; e = extract_material('repro.md'); print(len(e.units)); print([(r.locator, r.level, r.title) for r in e.outline])"
  • User-side workaround: re-upload the same content as .txt (which still uses the plain-text section splitter) or as .docx/.epub.

Filed by a user of v1.6.12 on Windows. I am not the author of #1574 or #1637; this report is independent and based on reading both PRs and the tagged release sources.

Steps to reproduce

No response

Expected Behavior

No response

Related Module

Dashboard

Configuration Used

No response

Logs and screenshots

No response

Additional Information

  • DeepTutor Version:
  • Operating System:
  • Python Version:
  • Node.js Version:
  • Browser (if applicable):
  • Related Issues: