Prompt Engineering
Why LLMs Choose Markdown
Module 6 · Prompt Engineering · Prerequisite. A step-by-step derivation of why Markdown wins.
The Core Tension
The Core Tension
LLMs are pure text models
An LLM outputs Token by Token — each Token is just a piece of text. It knows nothing about colors, font sizes, or alignment.
But users expect formatting
Headings, bold, lists, code blocks, links… plain text without any formatting is an extremely poor reading experience.
Deriving the Solution
1
HTML? Tags are too heavy — wastes Tokens
↓ No good
2
Word/PDF? Binary format — can't output Token by Token
↓ Even worse
3
LaTeX? Complex syntax — models make errors easily
↓ Also no
✓
Markdown: lightweight, elegant formatting built right into plain text
Markdown's three key advantages:
1. Plain-text compatible — models output Token by Token with no special encoding required
2. Formatting markers are minimal —
3. Frontend rendering is mature — libraries like marked.js / react-markdown handle it in one line of code
1. Plain-text compatible — models output Token by Token with no special encoding required
2. Formatting markers are minimal —
# ## ** cost only a few Tokens3. Frontend rendering is mature — libraries like marked.js / react-markdown handle it in one line of code
Conclusion: All major AI products (ChatGPT, Claude, Qwen) output Markdown by default.
This isn't a coincidence. It's the optimal solution for a plain-text model with formatting needs.
This isn't a coincidence. It's the optimal solution for a plain-text model with formatting needs.