Markdown output that agents actually parse — one dropped fence hint taught me
When I shipped the universal document-to-Markdown endpoint, the first integration I tested was feeding a 40-page PDF (full of code samples) into an agent's context window via RAG. The retrieval half worked fine; the generation half gave me garbage. The culprit: every fenced code block had lost its language hint. instead of python . The chunking logic in several retriever variants splits on language-tag boundaries, and without the hint, chunks bled into prose and the model hallucinated imports that matched the surrounding text. I traced it to a single line in the HTML-to-Markdown step: the language-* class on <pre> blocks was being stripped before code-block emission because I'd assumed agents don't care about syntax hints. They do — both directly, for context, and indirectly, in downstream tools that re-chunk. I fixed the emitter to carry through class="language-python" and any data-lang , then re-tested end to end. Quality jumped. The takeaway I ke...