If your Markdown looks good in preview but falls apart in Word or PDF, the problem is usually not one single feature. It is usually a combination of:
- unstable images
- weak heading structure
- overly complex list/code nesting
- renderer-specific extensions
- assumptions that preview and export behave the same way
The fastest path to better output is not “more formatting.” It is more predictable structure.
The Short Version
If you want safer Word/PDF export, do these first:
- use one clear H1 and clean H2/H3 hierarchy
- keep tables simple unless HTML is truly necessary
- use stable image sources and explicit sizing when needed
- keep code blocks and complex lists carefully indented
- isolate Mermaid and math instead of mixing them into fragile structures
- test one real export before sharing important documents
That is the practical baseline.
Start with Structure, Not Styling
Many export problems begin before images or tables ever show up.
Good export-friendly structure usually means:
# Quarterly Report
## Summary
## Findings
### Performance
### Risks
## Appendix
Why this matters:
- Word/PDF outline quality improves
- TOC generation becomes more predictable
- section links are easier to maintain
- the document reads like a real report instead of a visually hacked note
If a document uses headings mainly to make text “look bigger,” export quality usually gets worse, not better.
If you need the deeper version of this structural rule, read the Markdown Heading Guide. Clean headings do more for export quality than decorative formatting tricks, especially once a document gets long.
Images: Stable Sources Beat Clever Tricks
Images are one of the biggest export-risk categories.
The safest practices are:
- use a stable public
https://URL or uploaded asset - avoid relying on local absolute file paths in browser workflows
- use explicit size control when layout matters
- crop screenshots before export instead of dumping giant captures
Why this matters in md2word:
- remote images are pre-downloaded before export
- local absolute paths are not a reliable web-export strategy
- many images or many remote images increase conversion complexity
When those assumptions fail, the result is not always a subtle degradation. In the current pipeline, blocked local paths and failed remote downloads can trigger placeholder fallback behavior. That is why image review belongs in your export checklist, not just in the drafting phase.
If an image is important to the document, treat it like content infrastructure, not decoration.
For deeper image-specific guidance, read the full Markdown Images Guide.
Tables: Keep Them Readable, Not Just Technically Valid
A Markdown table can be syntactically valid and still export badly.
High-risk table patterns:
- too many columns
- giant text blocks inside cells
- mixed links, images, and code all inside the same row
- trying to force layout tricks that plain Markdown tables do not support
Safer pattern:
- reduce the table to essential columns
- keep one concept per column
- move commentary outside the table
- switch to HTML table only when you truly need advanced structure
If a table already feels cramped in the browser, it will usually feel worse in Word/PDF.
For deeper table guidance, read the Markdown Table Guide.
Code Blocks and Lists Need Discipline
Code blocks and lists are individually stable, but the combination is fragile when indentation drifts.
Safer pattern:
1. Install dependencies
```bash
pnpm install
pnpm test
```
Riskier pattern:
1. Install dependencies
```bash
pnpm install
```
What goes wrong:
- the code block may fall out of the list
- spacing changes after export
- hierarchy becomes visually confusing
If the document mixes lists, code blocks, screenshots, and long explanations in one place, check the indentation before you blame the exporter.
For deeper guidance, read the Markdown Code Block Guide and Markdown List Guide.
Mermaid, Math, and HTML Are Powerful but Not “Free”
These features add value, but they are not as portable as plain headings, paragraphs, and lists.
Mermaid
In md2word, Mermaid diagrams are rendered into images before export. That means Mermaid can work well, but it also means:
- rendering depends on the diagram pipeline being available
- width control is more stable when declared clearly
- Mermaid should stay in dedicated code fences, not be mixed into other fragile structures
If the render chain fails, do not assume the final file will keep an equivalent visual result. Read the full Markdown Mermaid Guide before you design a document that depends heavily on exported diagrams.
Math
Display math and LaTeX-style notation often need normalization before export. If formulas matter, keep them isolated and readable rather than hiding them inside dense paragraphs.
Preview rendering is not the same guarantee as export fidelity. If equations are central to the document, read the full Markdown LaTeX Guide and standardize your delimiter choice before the file gets harder to maintain.
If you also rely on footnotes or quote-style callouts, keep those structures simple too. Dense citation-heavy notes and nested admonition-like blocks are common places where preview and export start to drift apart.
Raw HTML
Raw HTML can be useful, especially for image sizing and some table structures. But HTML support is not a universal export guarantee. A renderer may accept HTML in preview and still treat it differently downstream.
Use HTML deliberately, not as a default escape hatch for every formatting problem.
Do Not Confuse “Preview Looks Fine” with “Export Is Safe”
This is one of the most expensive assumptions in Markdown workflows.
Preview and export may differ because:
- heading IDs are generated differently
- image paths resolve differently
- HTML support differs
- Mermaid/math handling differs
- layout constraints in Word/PDF are much tighter than in a browser pane
If the document is important, preview is only the first check. Final export is the real check.
What Makes a Document Heavy or Fragile
In the current md2word pipeline, complexity rises when a document combines:
- many images
- many remote resources
- Mermaid diagrams
- display math
- heavy HTML usage
- very long lines or paragraphs
That does not mean “do not use these features.” It means:
the more of them you combine in one file, the more carefully you should test the final output.
Pre-Export Checklist
Before exporting an important document, check these:
- headings follow a clean hierarchy
- section names are final enough that anchors will not move unexpectedly
- images are uploaded or point to stable URLs
- tables are not wider than the target page can realistically support
- list/code indentation is consistent
- Mermaid and math are isolated in their own blocks
- no critical content depends on renderer-specific HTML quirks
- at least one real DOCX or PDF export has been reviewed
FAQ
What usually breaks export first?
Images, overly complex tables, and list-plus-code indentation issues are among the most common early problems.
Is plain Markdown always safer than HTML?
Usually, but not always. For some cases like explicit image sizing, a small amount of deliberate HTML can be safer than vague Markdown assumptions.
Should I avoid Mermaid and math entirely?
No. Just isolate them, keep them intentional, and test final export instead of assuming preview parity.
Why does one document export fine while another similar one struggles?
The second one often has a higher combined complexity: more remote assets, more HTML, more diagrams, more long paragraphs, or more nested structures.
What is the best general rule?
Prefer simple, structural, explicit Markdown over clever formatting tricks.
Further Reading
- CommonMark Spec
- Pandoc Manual: Images
- Pandoc Manual: Headings and sections
- Pandoc Manual: Tables
- Pandoc Manual: Raw HTML
Changelog
- 2026-03-18: Initial high-value release with verified guidance on export-safe structure, image strategy, table risk, code/list stability, Mermaid/math boundaries, and a practical pre-export checklist.
- 2026-03-19: Added stronger md2word-specific notes on heading strategy, image placeholder fallback, and Mermaid/LaTeX failure modes.
Next steps: Explore Markdown Mermaid Guide, Markdown LaTeX Guide, Markdown Footnote Guide, Markdown Quote Guide, Markdown Images Guide, Markdown Heading Guide, Markdown Code Block Guide, Markdown List Guide, and Markdown Hyperlink.