Preview: headings overlap preceding blocks and paragraphs collapse to one character per line in longer documents
Summary
In the preview pane, ## headings are painted on top of the block above them, and in worse cases a whole paragraph collapses into a one-character-per-line column. The markdown itself is valid and the same files render correctly in Obsidian, so this looks like a layout/measurement bug in the preview rather than a parsing issue.
Environment
- Markpad version:
- OS: Windows
- Files: plain
.md, UTF-8 (no BOM), LF line endings, 7–48 KB, mostly Russian text - Content:
##/###headings, task lists, blockquotes, fenced code blocks with syntax highlighting, inline code
Actual behaviour
Two distinct failure modes, both in the preview pane:
- Heading overlap. An
h2is rendered over the last lines of the preceding paragraph or blockquote — both layers are visible at the same coordinates. The---that precedes the heading in the source ends up drawn below the heading instead of above it. - Column collapse. A paragraph is laid out at roughly one character of width, producing a vertical column of single letters, while other blocks render at normal width on the same screen.
Both appear only after scrolling into the document; the top of the file looks fine.
What I ruled out
The source files are not malformed. Verified by script:
- UTF-8, no BOM, no CR (LF only)
- no invisible characters (NBSP, zero-width, soft hyphen)
- no raw HTML
- balanced code fences
- blank lines present before and after every heading
The same files open correctly in Obsidian.
I then bisected one 11.7 KB / 134-line file into four variants and opened each in Markpad:
| Variant | Change | Result |
|---|---|---|
| A | exact copy of the original | breaks |
| B | every --- before a heading removed (120 lines) |
breaks |
| C | truncated to the first 75 lines (7.4 KB) | breaks |
| D | same file with one heading duplicated at the very top | breaks, including the duplicated heading near the top |
So it is not caused by --- before a heading, not by document length alone, and not by scroll depth alone.
A short synthetic 2.6 KB test file built from the same constructs (paragraph / blockquote / task list, with and without ---, h2 and h3, inline code in headings) rendered correctly. I was not able to reduce it to a minimal repro — it only reproduces on the real documents.
Possibly relevant
The broken renders were captured in windows roughly 890–1710 px wide. The synthetic file that rendered correctly was viewed in a maximised ~2000 px window. I have not tested the same file at both widths, so treat this as an observation, not a conclusion — but a width-dependent layout calculation would fit both symptoms, especially the one-character-per-line column.
Expected behaviour
Blocks render sequentially without overlapping, and paragraphs use the full content width.
Attachments
Screenshots of both failure modes attached below.
Thanks for the detailed report. The one-letter-per-line column was text after a code block inside a task item landing in the checkbox column, fixed in #834. The heading overlap was fixed earlier in #809: it happened when the preview was zoomed below 100%. Both will be in the next release. Until then, resetting the preview zoom to 100% avoids the overlap.