# MacMD Viewer - Full Content Index
> Canonical product facts and selected article bodies from macmdviewer.com, concatenated in a single file for AI consumption.
> Companion to llms.txt (the URL index). Use this file for product evaluation and the full text of priority resources.
Generated: 2026-07-11
Source: https://macmdviewer.com/llms-full.txt
Maker: Arthur Teboul (based in Paris, France). Contact: support@macmdviewer.com
## About MacMD Viewer
MacMD Viewer is a dedicated, read-only macOS application for reading Markdown (.md) files. A single license costs $19.99 USD one-time. There is no subscription, trial, or freemium tier. Purchase is available directly from macmdviewer.com.
The app renders GitHub-flavored Markdown with headings, tables, code blocks, syntax highlighting, footnotes, and Mermaid diagrams. Read-only by design: it never modifies user files. Bundles a QuickLook extension so Space-bar preview in Finder renders .md files inline.
It is NOT a Markdown editor. It is NOT an Electron app. It is NOT cross-platform. It is NOT a subscription.
## Priority product resources
- Product facts: https://macmdviewer.com/product-facts.md
- Machine-readable pricing: https://macmdviewer.com/pricing.md
- Visible pricing and direct purchase: https://macmdviewer.com/pricing
- Features: https://macmdviewer.com/features
- Quick Look: https://macmdviewer.com/quicklook
- Mermaid support: https://macmdviewer.com/mermaid
- Markdown viewer comparison: https://macmdviewer.com/blog/markdown-viewer-macos
- Open .md files on Mac: https://macmdviewer.com/guides/how-to-open-md-files-on-mac
- Claude and ChatGPT Markdown workflow: https://macmdviewer.com/blog/read-chatgpt-claude-markdown-output-mac
- AI-generated Markdown workflow: https://macmdviewer.com/blog/view-ai-markdown-output-mac
---
# MacMD Viewer — Product Facts
MacMD Viewer is a dedicated, read-only Markdown viewer for macOS. It renders Markdown without editing or modifying the source file.
## Canonical facts
- Product: MacMD Viewer
- Platform: macOS application
- Product type: Dedicated read-only Markdown viewer
- Price: $19.99 USD one-time for a single license
- License: One license for one Mac at a time
- Subscription: No
- Trial: No
- Freemium tier: No
- Purchase: Direct from https://macmdviewer.com/pricing
- Offline viewing: Yes
## Included capabilities
- Dedicated read-only Markdown viewer
- Quick Look previews in Finder
- Mermaid diagram rendering
- Syntax highlighting
- Offline viewing
- Live reload after external file changes
- Folder browsing in the Library
- Document outline navigation
- 12 document themes
## Quick Look workflow
MacMD Viewer includes a Finder Quick Look extension. After enabling the extension in macOS System Settings, select a local .md file in Finder and press Space to see rendered Markdown without opening the full application. Quick Look and the default app association are separate macOS settings.
Quick Look details: https://macmdviewer.com/quicklook
## Mermaid support
MacMD Viewer renders Mermaid code fences embedded in local Markdown files, including inside Finder Quick Look previews. Mermaid rendering works offline and does not turn MacMD Viewer into an editor: edit the source in another application, then read the rendered result in MacMD Viewer.
Mermaid details: https://macmdviewer.com/mermaid
## Files, folders, and live reload
The app opens individual Markdown files and can browse project or documentation folders through its Library. When an editor or coding agent saves an externally modified file, the open rendered document reloads while the source file remains read-only in MacMD Viewer.
Feature details: https://macmdviewer.com/features
## Positioning
MacMD Viewer is a viewer, not a Markdown editor. It is intended for people who write Markdown in another tool and want a dedicated macOS app for reading local Markdown files.
## Canonical pages
- Product features: https://macmdviewer.com/features
- Pricing and direct purchase: https://macmdviewer.com/pricing
- Quick Look: https://macmdviewer.com/quicklook
- Mermaid support: https://macmdviewer.com/mermaid
- Markdown viewer comparison: https://macmdviewer.com/blog/markdown-viewer-macos
---
# MacMD Viewer Pricing
## Single license
- Price: $19.99 USD one-time
- License: One license for one Mac at a time
- Product: Full MacMD Viewer macOS application
- Subscription: No
- Recurring fee: No
- Trial: No
- Freemium tier: No
- Purchase URL: https://macmdviewer.com/pricing
## Included
- Dedicated read-only Markdown viewer
- Quick Look previews in Finder
- Mermaid diagram rendering
- Syntax highlighting
- Offline viewing
- Live reload after external file changes
- Folder browsing in the Library
- Document outline navigation
- 12 document themes
MacMD Viewer is sold directly as a one-time purchase. It is a dedicated read-only viewer and does not include a Markdown editor.
---
# Blog posts (13)
# How to Save ChatGPT or Claude Output as Markdown on Mac
URL: https://macmdviewer.com/blog/read-chatgpt-claude-markdown-output-mac
Description: Copy a ChatGPT or Claude answer, save it as a local .md file on Mac, and read the formatted result without uploading private output to another web tool.
Published: 2026-06-24
Updated: 2026-07-11
Category: Tutorial
ChatGPT and Claude format long answers with headings, tables, code fences, checklists, and sometimes Mermaid diagrams. When an answer becomes a spec, brief, checklist, or reference you want to keep, save it as a local `.md` file instead of leaving it buried in chat history.
The problem is that macOS still opens Markdown as raw text by default. A response that looked structured inside Claude or ChatGPT becomes a wall of hashes, backticks, pipes, and dashes when you double-click the file.
The clean workflow is simple: save the output as Markdown, read it locally, and keep your editor for editing. For background, Markdown is a plain-text format standardized by [CommonMark](https://commonmark.org/), and many AI tools preserve that syntax when copying or writing generated files.
## Direct Answer
To save ChatGPT or Claude output as Markdown on Mac, copy the response, paste it into a plain-text document, and save the filename with a `.md` extension—for example, `research-notes.md`. Open that file in a local Markdown viewer to see the headings, tables, code blocks, and diagrams rendered without sending the answer to another website.
## The Short Version
To read Claude or ChatGPT Markdown output on Mac:
1. Copy the AI response.
2. Paste it into a plain-text file.
3. Save the file with a `.md` extension.
4. Open it in a Markdown viewer such as [MacMD Viewer](/features).
5. Select the file in Finder and press Space when you only need a fast QuickLook preview.
If a coding agent already writes files such as `CLAUDE.md`, `AGENTS.md`, plans, and specs into your repository, skip the copy workflow and use the dedicated guide to [reading Claude Code Markdown on Mac](/blog/view-ai-markdown-output-mac).
## Best Method by AI Tool
| AI tool | Best workflow on Mac | Why it works |
|---|---|---|
| ChatGPT | Copy answer, save as `.md`, open in MacMD Viewer | Keeps a rendered local copy of long responses |
| Claude | Copy answer or exported artifact, save as `.md`, preview with QuickLook | Preserves headings, lists, tables, and code fences |
## Why AI Output Should Not Live in Your Chat Window
The chat interface is good for generation, but poor for reading longer documents. It gives you a narrow scroll area, hidden context, and no normal file workflow. Once the answer becomes a spec, brief, README, changelog, or implementation plan, it is better as a local `.md` file.
Saving the output locally gives you:
- a real file you can archive, rename, or share;
- Finder search and folder organization;
- rendered headings and tables instead of raw syntax;
- local preview without uploading private prompts;
- a stable reading window next to Cursor, Xcode, VS Code, or Terminal.
For files written directly by coding agents, see the separate workflow for [reading `CLAUDE.md`, `AGENTS.md`, plans, and specs](/blog/view-ai-markdown-output-mac). This page stays focused on turning a response from the ChatGPT or Claude chat interface into a local file.
## Why Not Use VS Code or Cursor Preview?
VS Code and Cursor can preview Markdown, and they are fine when you are already editing the file. Microsoft documents VS Code's built-in [Markdown preview](https://code.visualstudio.com/docs/languages/markdown), but that preview still lives inside the editor. The friction starts when you only want to read.
For AI output, a full editor is often the wrong shape:
| Need | Editor preview | Dedicated viewer |
|---|---|---|
| Read a generated `.md` file | Works, but opens a full IDE | Opens as a reading surface |
| Finder preview | No QuickLook rendering | Space-bar preview with QuickLook |
| Mermaid diagrams | Usually needs setup | Built in with MacMD Viewer |
| Agent overwrites file | Can be inconsistent by workflow | Live reload is the core job |
| Accidental edits | Possible | Read-only by design |
Use the editor when you want to change the file. Use a viewer when you want to read it.
## A Local Workflow for Claude and ChatGPT
### ChatGPT
Click Copy on the answer, paste into a plain-text editor, and save as `topic.md`. Then open that file in a Markdown viewer. For one-off responses, Finder QuickLook is usually enough: select the file and press Space.
### Claude
Claude responses preserve Markdown structure when copied. Save them as `.md` files when the response becomes a plan, spec, or reference you may want to revisit. If the answer includes Mermaid diagrams, use a viewer that renders Mermaid code fences.
## How QuickLook Fits This Workflow
Apple's [Quick Look](https://support.apple.com/guide/mac-help/view-and-edit-files-with-quick-look-mh14119/mac) is designed for fast file preview from Finder. Markdown is not rendered by macOS out of the box, so a `.md` file usually appears as plain text. A viewer with a QuickLook extension fills that gap: select the file, press Space, and read the rendered document without opening a full editor.
## Keep AI Markdown Local by Default
Online Markdown preview tools are convenient, but AI output is often sensitive. A generated answer may include:
- private prompts;
- internal class names, paths, APIs, or endpoints;
- customer or business context;
- architectural decisions;
- copied snippets from proprietary code;
- credentials accidentally echoed by a tool or log.
For public README snippets, an online previewer is fine. For AI-generated work product, local rendering is the safer default.
## Recommended Setup
For a Mac workflow, pair three tools:
| Job | Tool |
|---|---|
| Generate or edit | Claude, ChatGPT, Cursor, VS Code, Xcode, Terminal |
| Read generated `.md` files | MacMD Viewer |
| Skim files in Finder | QuickLook via MacMD Viewer |
This keeps each tool focused. Your AI assistant generates, your editor edits, and your viewer reads.
## Related Mac Markdown Workflows
- For a broader Mac viewer comparison, read [best Markdown viewers for macOS](/blog/markdown-viewer-macos).
- For the Finder workflow, read [Markdown QuickLook on Mac](/blog/markdown-quicklook-mac-guide).
- For editor-preview tradeoffs, read [Preview Markdown on Mac Without VS Code](/blog/preview-markdown-without-vscode-mac).
- For Mermaid-heavy AI output, see [MacMD Viewer Mermaid support](/mermaid).
## FAQ
### How do I read ChatGPT Markdown output on Mac?
Copy the ChatGPT response, save it as a `.md` file, then open it in a Markdown viewer. A native Mac viewer such as [MacMD Viewer](/features) renders headings, tables, code blocks, and Mermaid diagrams locally without uploading the content to an online preview tool.
### How do I read Claude Markdown files on Mac?
Save Claude output with a `.md` extension and open it in a local viewer. If Claude Code or another agent writes the file directly, keep the file open in a viewer with live reload so the rendered preview updates when the agent overwrites it.
### Can Finder preview AI-generated Markdown files?
Yes. Install a Markdown viewer with a QuickLook extension, then select the `.md` file in Finder and press Space. MacMD Viewer renders Markdown in QuickLook, including code blocks, tables, and Mermaid diagrams.
### Is it safe to paste AI output into an online Markdown viewer?
Treat it as sensitive by default. AI output can contain prompts, internal code, API names, customer details, or strategy notes. A local Mac viewer avoids sending that content to a third-party web app.
## Next Step
If AI tools are producing Markdown files you actually need to read, install [MacMD Viewer](/pricing). It is built for local Markdown reading on Mac: QuickLook preview, Mermaid rendering, syntax highlighting, live reload, and a read-only document model.
---
# Best Markdown Viewer for Claude Code Files on Mac
URL: https://macmdviewer.com/blog/view-ai-markdown-output-mac
Description: Read CLAUDE.md, AGENTS.md, plans, specs, and other Markdown generated by Claude Code or coding agents on Mac with live reload, Mermaid, and QuickLook.
Published: 2026-05-14
Updated: 2026-07-11
Category: Tutorial
Claude Code, Codex, Cursor, and other coding agents write Markdown directly into repositories: `CLAUDE.md`, `AGENTS.md`, implementation plans, architecture notes, review reports, and generated specs. These are documents you need to read while the agent or your editor continues changing them.
The most practical Mac setup is to keep your coding tool for editing and open the generated file in a separate read-only viewer. MacMD Viewer renders the local file, supports Mermaid code fences, refreshes after external saves, and adds a Space-bar preview in Finder through QuickLook.
> **Direct answer:** To read `CLAUDE.md`, `AGENTS.md`, a generated plan, or an AI-written spec on Mac, open the file in a local Markdown viewer and leave it open while the agent works. MacMD Viewer is read-only, renders Mermaid, and reloads the open document when another process saves it.
> **Key Takeaways**
> - Coding agents use `.md` files for plans, instructions, reviews, and documentation.
> - Keeping generated work local avoids copying potentially sensitive context into another web service.
> - [MacMD Viewer](/features) is a native SwiftUI app with Mermaid, QuickLook, folder browsing, and live reload for $19.99 one-time.
## Which AI-Generated Markdown Files Can You Read This Way?
The same workflow works for any plain-text Markdown file, including:
- `CLAUDE.md` project instructions used by Claude Code;
- `AGENTS.md` instructions used by coding agents;
- `README.md` and documentation generated during implementation;
- `plan.md`, `spec.md`, decision records, and architecture notes;
- code-review summaries, migration plans, and release notes;
- Markdown containing tables, task lists, code blocks, or Mermaid diagrams.
MacMD does not interpret agent instructions or run code from these files. It renders the Markdown as a document. Your agent or editor remains responsible for changing the source.
## Why View AI Markdown Output Separately From Your Editor?
The Markdown that comes out of Claude Code, Cursor, or ChatGPT is read-once content: a generated spec, a code review summary, a design doc draft, a debugging transcript. You'll scan it, maybe act on it, and rarely revisit. Treating that traffic the same as long-term notes inflates your toolchain.
There are three problems with leaving AI Markdown inside your editor:
1. **The preview pane competes with editing.** Cursor and VS Code split your screen between code and preview. Once the agent finishes writing, you want to *read* — not edit — and the editor UI keeps offering you a cursor.
2. **Mermaid breaks without configuration.** AI assistants emit [Mermaid](https://mermaid.js.org/intro/) code fences frequently in 2026 (architecture diagrams, sequence flows, decision trees). VS Code's built-in preview doesn't render them; you need an extension. Cursor inherits the same gap.
3. **The preview doesn't survive a session.** Close the editor and the preview pane closes with it. A dedicated viewer keeps the rendered file open while you switch projects.
> AI assistants produce read-once Markdown by the dozen—specs, transcripts, summaries, and agent output. A focused native viewer like [MacMD Viewer](/features) gives that stream a separate reading surface without turning every file into an editing or knowledge-base workflow.
## What Is the Right Workflow for AI Markdown on Mac?
The shortest path is three steps: save, render, move on. The friction comes from picking tools that don't get in the way.
1. **Let the agent write the `.md` file.** Claude Code, Codex, and Cursor commonly create or update plans, specs, and repository instructions directly. If the output only exists in a web chat, follow the separate guide to [save Claude or ChatGPT output as Markdown](/blog/read-chatgpt-claude-markdown-output-mac).
2. **Open the file in a native viewer.** MacMD Viewer opens via `cmd+O`, double-click in Finder, or Space-bar QuickLook for inline preview without opening the app at all.
3. **Let the viewer watch the file.** If you re-prompt and overwrite the same `.md` with a new response, the viewer refreshes the preview as soon as the file changes. No reload, no scroll reset.
This works because MacMD Viewer is a viewer, not an editor. It renders the Markdown and watches the open file, while the agent or editor remains the only tool changing the source.
### A practical Claude Code workflow
1. Open the repository in Terminal and start Claude Code.
2. Open the generated plan or spec in MacMD Viewer from Finder.
3. Keep Terminal and the viewer side by side.
4. Ask Claude to revise the same file.
5. Review the refreshed rendered document before approving the next implementation step.
For a folder containing several plans and specs, open MacMD Viewer's Library with `Cmd+L` and add the project or documentation folder. This gives you a read-only folder tree without turning the repository into an Obsidian vault.
### When QuickLook Beats Opening the App
If you're scanning a directory of AI transcripts in Finder, QuickLook is the right interaction model. Arrow keys move between files. Space toggles preview. The file renders inline with Mermaid diagrams, syntax-highlighted code, and tables — no app launch. For a deeper QuickLook + Markdown workflow on Mac, see our [Markdown apps for Mac roundup](/blog/markdown-app-mac).
## How Does MacMD Viewer Compare to Editor and Browser Previews?
For pure viewing, a dedicated native viewer beats editor previews on three axes: weight, Mermaid support, and file-watching reliability. The trade-off is no editing — which is exactly the point for AI-output workflows where the file is read-only by default.
| Approach | Primary role | Mermaid | File watch | Data location |
|:---------|:-------------|:--------|:-----------|:--------------|
| MacMD Viewer | Dedicated read-only viewer | Built-in | Yes (auto) | Local |
| VS Code / Cursor preview | Code editor + preview | Needs extension | Yes | Local |
| Browser viewer | One-off web preview | Mixed | No | Verify each service |
| Obsidian preview | Knowledge base + editor | Yes (preview mode) | Yes (in vault) | Local |
| Typora | Markdown editor | Built-in | Yes | Local |
For the full landscape comparison see our [best Markdown viewers for macOS](/blog/markdown-viewer-macos) post. For when Obsidian is the wrong shape (which is most AI-output workflows), see our [Obsidian alternative on Mac](/blog/obsidian-alternative-mac) write-up.
> A dedicated viewer trades editing features for a stable reading window, built-in Mermaid rendering, and live reload when an agent overwrites the open file. For plans and specs that are being generated elsewhere, that separation is the point.
## Why Should You Avoid Online Markdown Viewers for AI Output?
Online viewers are frictionless: paste, render, done. But their privacy and storage behavior varies by service, so you must verify how each tool handles the content. A local viewer removes that question for files that already live on your Mac.
A typical Claude or ChatGPT response contains some combination of:
- The original prompt you asked (often quoted at the top)
- Code referencing internal function names, environment variables, or API endpoints
- Decisions about architecture, pricing, or strategy
- Customer data the AI was reasoning over
- API keys or credentials the AI helpfully echoed back
Before pasting that material into a web tool, check whether processing is client-side, whether the page sends analytics payloads, and what the service retains. Rendering the local `.md` file in a desktop viewer avoids making those checks part of every review.
### When Online Viewers Are Acceptable
The narrow case: rendering a Markdown snippet that's already public (open-source README, blog draft, social post). For everything from AI assistants — where the prompt context is almost always private — render locally. A native viewer is the privacy-safe default.
## What Are Best Practices for AI Markdown Workflows on Mac?
A few habits make the AI-output stream painless instead of cluttered.
### Use a Predictable File Naming Convention
For long Claude or ChatGPT sessions, save to `~/Documents/ai-transcripts/YYYY-MM-DD-topic.md`. Sortable, scannable, and Finder + QuickLook can navigate the folder with arrow keys. Avoid timestamps in milliseconds — date is enough.
### Keep Mermaid in Fenced Code Blocks
AI assistants natively emit Mermaid inside ```` ```mermaid ```` fences. MacMD Viewer renders these inline. Don't manually convert them to images — you'll lose the source. For deeper Mermaid usage see our [Mermaid Live Editor guide](/blog/mermaid-live-editor-guide).
### Re-Prompt and Overwrite the Same File
When iterating on a spec or summary, overwrite the same `.md` filename instead of creating new files. The viewer watches the file and refreshes the preview automatically — you see each new response immediately without reopening. For Cursor-specific preview reliability issues (where the agent overwrite doesn't always trigger an editor refresh), a dedicated viewer is the workaround.
### Pair With Your Editor, Don't Replace It
Cursor or VS Code stay your editing surface. The viewer is for reading. Many users keep Cursor on the left half of their screen and MacMD Viewer on the right — write or run the agent in one, read in the other. The viewer's QuickLook integration also handles the "I want to peek at a `.md` in another folder" case without breaking your editor focus.
> **Workflow tip:** Keep stable filenames such as `plan.md` or `architecture.md` during an iteration. When the agent updates the same file, a file-watching viewer can refresh the rendered document instead of making you reopen a succession of timestamped copies.
## FAQ
### What is the best way to read CLAUDE.md on Mac?
Open `CLAUDE.md` in a local Markdown viewer when you want a rendered reading view, or in your editor when you want to change the instructions. MacMD Viewer keeps the file read-only, renders headings and code blocks, and can remain open while Claude Code updates other project documents.
### Can MacMD Viewer open AGENTS.md files?
Yes. `AGENTS.md` is a standard Markdown file, so MacMD Viewer renders it like a README or spec. The app displays the document but does not execute or interpret the agent instructions inside it.
### How do I review a plan while Claude Code updates it?
Open the plan in MacMD Viewer and keep the viewer beside Terminal or your editor. When Claude Code saves changes to that same file, the open rendered document refreshes automatically.
### How do I save Claude or ChatGPT output as a Markdown file?
Highlight the assistant response, copy it, and paste into any text editor. Save with a `.md` extension. Claude.ai and Claude desktop both copy responses preserving Markdown syntax. ChatGPT does too via its Copy button. Cursor and GitHub Copilot work directly with `.md` files in your repo.
### Can a Markdown viewer render Mermaid diagrams from AI output?
Yes if the viewer supports Mermaid natively. MacMD Viewer and Obsidian render Mermaid in preview without plugins. VS Code and Cursor need the [Markdown Preview Mermaid Support](https://marketplace.visualstudio.com/items?itemName=bierner.markdown-mermaid) extension. AI assistants frequently output Mermaid code fences, so native support matters more in 2026 than it did pre-LLM.
### Why not just use VS Code or Cursor's built-in preview?
You can. The friction is weight and reliability — Cursor's preview pane has known reload bugs after agent file edits, and VS Code's preview lacks built-in Mermaid. A separate viewer that watches the file gives you a stable preview that survives editor sessions.
### Is it safe to paste Claude output into an online Markdown viewer?
Risky. Online viewers receive whatever you paste — including private prompts, code, API keys, or business context the AI was reasoning over. A native Mac viewer processes the file locally with no network call. Treat AI output as sensitive by default.
### Does MacMD Viewer auto-refresh when I overwrite an AI output file?
Yes. MacMD Viewer watches the open file and refreshes as soon as the file changes. Useful when you re-prompt and save the new response to the same filename — the view updates without manually reopening.
### Can I render AI Markdown via QuickLook without opening any app?
Yes. With MacMD Viewer installed, hit Space on any `.md` file in Finder and macOS QuickLook renders it inline — Mermaid diagrams, syntax-highlighted code, tables. Zero app switch, no window.
## Conclusion
AI Markdown output is read-once, sensitive, and produced in volume. The right tool for the job is a native viewer that renders fast, supports Mermaid out of the box, watches files for live reload, and keeps your prompts local.
Three takeaways:
- **Save AI output to `.md`, view it natively, move on.** No vault, no online viewer, no editor preview clutter.
- **Privacy first.** AI output can contain private context. Keeping the file local avoids sharing it with an additional service.
- **Pair editor with viewer.** Cursor or VS Code for writing and running agents; MacMD Viewer on the other half of the screen for reading.
If coding agents regularly leave plans, specs, and instruction files in your repositories, [MacMD Viewer](/pricing) gives those files a dedicated read-only surface with Mermaid, QuickLook, folder browsing, and live reload. It costs $19.99 once. For the broader Mac Markdown landscape, see our [Markdown apps for Mac roundup](/blog/markdown-app-mac).
---
# Mermaid ER Diagram: Complete Syntax Guide (2026)
URL: https://macmdviewer.com/blog/mermaid-er-diagram-guide
Description: Full Mermaid ER diagram syntax reference — entities, attributes, relationship notation, PK/FK keys, and real-world examples for database documentation.
Published: 2026-04-05
Updated: 2026-05-29
Category: Tutorial
Mermaid ER diagrams let you document database schemas and data models in plain text, inside the same Markdown files as your code documentation. Search interest in "mermaid er diagram" has grown steadily — development teams are moving away from screenshot-based database diagrams toward version-controlled, text-based alternatives. [MacMD Viewer](/features) ($19.99, native macOS SwiftUI app) renders Mermaid ER diagrams locally in `.md` files with no plugins or internet connection. This guide covers the full `erDiagram` syntax with working examples you can copy directly into your documentation.
> **TL;DR:** Start with `erDiagram`, define entities using `ENTITY { type name PK }`, connect them with `||--o{` for one-to-many relationships. Use `--` for identifying relationships and `..` for non-identifying. Preview locally with MacMD Viewer or online at [mermaid.live](https://mermaid.live/).
## What Is a Mermaid ER Diagram and When Should You Use It?
A Mermaid ER diagram is a text-based entity-relationship diagram that describes database tables, their columns, and how they relate to each other. You write it inside a ` ```mermaid ` code fence starting with `erDiagram`, and any Mermaid renderer produces a visual diagram from that text. The [official Mermaid ER diagram documentation](https://mermaid.js.org/syntax/entityRelationshipDiagram.html) is the canonical reference for every supported notation.
ER diagrams are useful in three primary contexts:
- **Database design** — sketch the schema before writing migrations, catch relationship mistakes early
- **Technical documentation** — explain the data model to new engineers without maintaining a separate diagram file
- **Code review** — include an ER diagram in a PR to show how a migration changes the schema
Compared to dedicated tools like dbdiagram.io or draw.io, the Mermaid approach has one decisive advantage: the diagram lives in your repository as plain text, so Git tracks every change. When a column is renamed or a relationship is added, the diff shows exactly what changed — you never end up with a stale PNG that no longer matches the actual schema.
ER diagrams have been stable in Mermaid since v8, and every current renderer supports them — the diagram type is maintained in the open-source [Mermaid repository on GitHub](https://github.com/mermaid-js/mermaid). For related Mermaid diagram types, see the [Mermaid flowchart syntax guide](/blog/mermaid-flowchart-syntax) and the [Mermaid sequence diagram guide](/blog/mermaid-sequence-diagram-guide).
## How Do You Write Basic Mermaid ER Diagram Syntax?
An ER diagram starts with `erDiagram`, followed by entity blocks and relationship lines. Here is the minimal structure that renders a valid diagram:
```mermaid
erDiagram
USER {
int id PK
string email UK
string name
date createdAt
}
POST {
int id PK
int userId FK
string title
string body
datetime publishedAt
}
USER ||--o{ POST : "writes"
```
This produces two entity boxes connected by a one-to-many line labeled "writes". The `USER` entity has four attributes: an integer primary key, a unique email, a name, and a creation date. The `POST` entity has a foreign key back to `USER`.
Every entity block follows the same pattern:
```
ENTITY_NAME {
type attributeName optionalKey
type attributeName optionalKey
}
```
Entity names are typically uppercase by convention, though Mermaid accepts any case. Attribute types are free-form strings — Mermaid does not validate them against a schema, so you can write `varchar(255)`, `string`, or `TEXT` and the diagram renders identically. Stick to a consistent set of types across your codebase.
### Supported Attribute Types
Common types used in Mermaid ER diagrams:
| Type | Use Case |
|------|----------|
| `int` | Integer identifier or counter |
| `bigint` | Large integer (user IDs at scale) |
| `string` | Short text (names, slugs, status) |
| `text` | Long text (body content, descriptions) |
| `boolean` | True/false flags |
| `float` / `decimal` | Numeric values with decimals |
| `date` | Date without time |
| `datetime` | Full timestamp |
| `uuid` | UUID primary key |
| `json` | JSON blob column |
## How Do You Add Keys to ER Diagram Attributes?
Mermaid supports three key markers that appear after the attribute name. Add them as a suffix with a space:
| Marker | Meaning |
|--------|---------|
| `PK` | Primary key |
| `FK` | Foreign key |
| `UK` | Unique key (unique constraint) |
An attribute can have multiple markers if needed — `int id PK` is the most common pattern, but `string email UK` marks a unique constraint and `int orderId FK` marks a foreign key reference.
```mermaid
erDiagram
CUSTOMER {
uuid id PK
string email UK
string firstName
string lastName
date createdAt
}
ORDER {
uuid id PK
uuid customerId FK
decimal totalAmount
string status
datetime placedAt
}
CUSTOMER ||--o{ ORDER : "places"
```
Comments use `%%` at the start of a line, identical to other Mermaid diagram types:
```
%% This diagram documents the e-commerce schema v2
erDiagram
PRODUCT {
int id PK
string sku UK
}
```
## What Does the Relationship Notation Mean?
The relationship line syntax is the most distinctive part of Mermaid ER diagrams. The notation `||--o{` looks cryptic at first, but each character has a specific meaning that maps directly to standard crow's foot notation.
A relationship line has five components:
```
ENTITY1 LEFT_MARKER -- RIGHT_MARKER ENTITY2 : "label"
```
The `--` (double dash) is the line style. Use `--` for an **identifying relationship** (the child depends on the parent for its identity) or `..` for a **non-identifying relationship** (both entities exist independently).
### Cardinality Markers
Each side of the line takes a two-character cardinality marker:
| Marker | Meaning | Description |
|--------|---------|-------------|
| `\|\|` | Exactly one | Mandatory, singular |
| `o\|` | Zero or one | Optional, singular |
| `\|{` | One or more | Mandatory, plural |
| `o{` | Zero or more | Optional, plural |
Reading `||--o{` from left to right: exactly one (on the left entity) — identifying relationship — zero or more (on the right entity). This is a standard one-to-many.
### Full Notation Reference
| Notation | Cardinality | Real-World Example |
|----------|-------------|-------------------|
| `\|\|--\|\|` | One-to-one | USER has one PROFILE |
| `\|\|--o\|` | One-to-zero-or-one | USER has optional BILLING_ADDRESS |
| `\|\|--o{` | One-to-zero-or-many | CUSTOMER places zero or more ORDERS |
| `\|\|--\|{` | One-to-one-or-many | ORDER contains one or more ORDER_ITEMS |
| `o{--o{` | Many-to-many | PRODUCT belongs to many CATEGORIES |
| `\|\|..o{` | Non-identifying one-to-many | POST has zero or more COMMENTS |
The label after the colon is required in Mermaid ER syntax. Wrap it in double quotes: `: "places"`, `: "contains"`, `: "belongs to"`. The label describes the relationship from the perspective of the left entity.
## What Does a Real-World ER Diagram Look Like?
Here is a complete e-commerce schema covering the four core tables most production systems share: customers, products, orders, and order line items.
```mermaid
erDiagram
CUSTOMER {
uuid id PK
string email UK
string firstName
string lastName
string phone
date createdAt
}
ADDRESS {
uuid id PK
uuid customerId FK
string street
string city
string country
string postalCode
boolean isDefault
}
PRODUCT {
uuid id PK
string sku UK
string name
text description
decimal price
int stockQuantity
boolean isActive
}
ORDER {
uuid id PK
uuid customerId FK
uuid shippingAddressId FK
string status
decimal subtotal
decimal shippingCost
decimal totalAmount
datetime placedAt
}
ORDER_ITEM {
uuid id PK
uuid orderId FK
uuid productId FK
int quantity
decimal unitPrice
decimal lineTotal
}
CUSTOMER ||--o{ ADDRESS : "has"
CUSTOMER ||--o{ ORDER : "places"
ADDRESS ||--o{ ORDER : "ships to"
ORDER ||--|{ ORDER_ITEM : "contains"
PRODUCT ||--o{ ORDER_ITEM : "included in"
```
This diagram captures the full purchase flow: customers own addresses and place orders, orders are shipped to one address and contain one or more items, and each item references the product it sold. The `ORDER_ITEM` table uses identifying relationships (`--`) because a line item cannot exist without its parent order. The `ADDRESS` to `ORDER` link is also identifying for the same reason.
For a blog platform, the schema looks like this:
```mermaid
erDiagram
USER {
int id PK
string username UK
string email UK
string passwordHash
datetime createdAt
}
POST {
int id PK
int authorId FK
string title
string slug UK
text body
string status
datetime publishedAt
}
COMMENT {
int id PK
int postId FK
int authorId FK
text body
datetime createdAt
}
TAG {
int id PK
string name UK
string slug UK
}
POST_TAG {
int postId FK
int tagId FK
}
USER ||--o{ POST : "writes"
USER ||--o{ COMMENT : "authors"
POST ||--o{ COMMENT : "has"
POST ||--o{ POST_TAG : "tagged with"
TAG ||--o{ POST_TAG : "applied to"
```
The `POST_TAG` junction table implements the many-to-many relationship between posts and tags. Both foreign keys together form the composite primary key, which is common for join tables.
## What Are the Most Common ER Diagram Mistakes?
Four mistakes appear repeatedly in Mermaid ER diagrams written by developers new to the syntax.
**Wrong relationship direction.** The label should read naturally from left to right: `CUSTOMER ||--o{ ORDER : "places"` — a customer places orders, not the other way around. Reversing the entities reverses the cardinality meaning, which produces a diagram that renders but communicates the opposite of the intended relationship.
**Missing relationship label.** The label after `: ` is not optional in Mermaid's ER syntax. Omitting it throws a parse error. Use a short verb phrase: `"has"`, `"contains"`, `"belongs to"`.
**Confusing `--` and `..`.** Use `--` (identifying) when the child row has no meaning without the parent — an order item without an order is meaningless. Use `..` (non-identifying) when both can exist independently — a product exists even if no orders have ever included it.
**Spaces in entity names.** Entity names cannot contain spaces. Use `ORDER_ITEM` or `OrderItem`, not `ORDER ITEM`. The underscore convention matches SQL naming and is the most common pattern in the wild.
## Where Do Mermaid ER Diagrams Render?
Mermaid ER diagrams render anywhere the Mermaid.js library is present:
| Platform | Notes |
|----------|-------|
| **MacMD Viewer** | Native macOS app, renders locally, no internet needed. [Download here](/download). |
| **GitHub** | Renders natively in `.md` files since 2022 — push your diagram, GitHub displays it. |
| **GitLab** | Built-in Mermaid rendering in Markdown files and wikis. |
| **Notion** | Use the `/code` block, select Mermaid as the language. |
| **Confluence** | Requires the Mermaid for Confluence plugin. See the [Mermaid Confluence guide](/blog/mermaid-diagrams-confluence). |
| **Mermaid Live Editor** | Free browser playground at [mermaid.live](https://mermaid.live/). Best for iterating. |
| **Obsidian** | Renders natively — no plugin needed. |
| **VS Code** | Use the Markdown Mermaid extension with `Cmd+Shift+V`. |
For a full comparison of browser-based options, see [online Mermaid diagram tools](/blog/mermaid-live-editor-guide). If you want to export diagrams as PNG or SVG files, the Mermaid live editor guide covers the export workflow. You can also use the [Mermaid viewer](/blog/mermaid-viewer) roundup to compare dedicated rendering tools.
## How Does Mermaid Compare to Dedicated ER Diagram Tools?
Dedicated tools like dbdiagram.io, draw.io, and Lucidchart offer richer visual editing: drag-and-drop layout control, auto-generated SQL from your schema, and export to multiple formats. For teams that need a polished standalone diagram, those tools are the right choice.
Mermaid wins when your diagram lives inside documentation. Three specific advantages:
1. **Version control** — the diagram is a text file, so `git diff` shows exactly what changed between schema versions. A PNG has no diff.
2. **Documentation co-location** — the schema lives next to the code in the same repository. No separate diagramming account, no broken links to external tools.
3. **Renderer ubiquity** — GitHub, GitLab, Notion, Obsidian, and VS Code all render Mermaid natively. Your diagram is readable anywhere your Markdown file opens.
The tradeoff is layout control. Mermaid places entities automatically — you cannot manually position boxes. For large schemas (30+ tables), auto-layout produces cluttered output. In that case, split the schema into domain-specific sub-diagrams: one for user management, one for orders, one for inventory.
[MacMD Viewer](/features) is the fastest local option on macOS: open a `.md` file and the ER diagram renders immediately. The [QuickLook extension](/download) also renders Mermaid when you press Space on a `.md` file in Finder — useful when reviewing schema documentation without opening any app.
## Conclusion
Mermaid ER diagram syntax is compact: declare `erDiagram`, define entities with typed attributes and key markers, connect them with cardinality notation. The `||--o{` relationship syntax covers every cardinality combination once you know that `||` means exactly-one, `o|` means zero-or-one, `|{` means one-or-more, and `o{` means zero-or-more. Use `--` for identifying relationships and `..` for non-identifying.
Copy the e-commerce or blog schema examples above, replace entity names and attributes with your own tables, and you have a working database diagram that lives in version control. Preview locally with MacMD Viewer for instant rendering on Mac, or iterate in the browser at mermaid.live. For more Mermaid diagram types, see the [complete Mermaid diagram guide](/blog/mermaid-live-editor-guide) and the [Mermaid flowchart syntax reference](/blog/mermaid-flowchart-syntax).
## Frequently Asked Questions
**What is the syntax for a Mermaid ER diagram?**
A Mermaid ER diagram starts with the erDiagram keyword. Define entities with their attributes inside curly braces — for example, `USER { int id PK, string email, string name }`. Connect entities with relationship lines using the notation `ENTITY1 ||--o{ ENTITY2 : "label"`. The double pipe (`||`) means exactly one, the open circle (`o{`) means zero or more.
**How do I add primary keys and foreign keys in a Mermaid ER diagram?**
Add PK, FK, or UK as a suffix after the attribute name inside the entity block. For example: int id PK declares a primary key, int userId FK declares a foreign key, and string email UK declares a unique key. Multiple key types can appear on the same attribute when needed.
**What does the `||--o{` notation mean in Mermaid?**
The notation reads from left to right. `||` means exactly one on the left side. `--` is an identifying (solid) relationship line. `o{` means zero or more on the right side. So `||--o{` reads as one-to-many. Each symbol position has a specific meaning: `|` is one, `o` is zero, and `{` or `}` is many (one-or-more when combined with `|`).
**What is the difference between -- and .. in Mermaid ER diagrams?**
The double dash (--) represents an identifying relationship, where the child entity's existence depends on the parent — for example, an OrderItem cannot exist without an Order. The double dot (..) represents a non-identifying relationship, where the child can exist independently — for example, a Product exists even if no OrderItems reference it.
**Can MacMD Viewer render Mermaid ER diagrams?**
Yes. MacMD Viewer renders all Mermaid diagram types including ER diagrams in local .md files on Mac. Open any file containing an erDiagram code fence and the diagram renders instantly with no plugins or internet connection required.
---
# Markdown to Word: How to Convert .md to .docx (2026)
URL: https://macmdviewer.com/blog/markdown-to-word-guide
Description: Convert Markdown to Word (.docx) using Pandoc, VS Code, Python, or online tools. Includes the exact CLI commands, a custom template walkthrough, and macOS setup.
Published: 2026-04-04
Updated: 2026-04-04
> **TL;DR:** The fastest way to convert Markdown to Word on macOS is Pandoc: `brew install pandoc`, then `pandoc input.md -o output.docx`. For corporate documents with custom styles, add `--reference-doc=template.docx`. Online converters (CloudConvert) work for one-off files but upload your content to a third-party server. Preview your Markdown first in MacMD Viewer to catch formatting issues before converting.
Markdown is the preferred format for writing documentation, README files, and technical notes — but at some point, someone on your team will ask for a Word document. Whether it is a client deliverable, a legal review, or a corporate template requirement, `.docx` is still the lingua franca of office collaboration.
Converting Markdown to Word is not as simple as copy-pasting the rendered output. A proper conversion needs to map Markdown headings to Word heading styles, preserve tables, handle code blocks with monospace formatting, and carry over images and footnotes. Doing this correctly requires the right tool and the right workflow.
This guide covers every practical method — from Pandoc on the command line to online converters and Python scripting — with the exact commands for macOS. For converting Markdown to PDF instead, see the [Markdown to PDF on Mac guide](/blog/markdown-to-pdf-mac) or the general Markdown to PDF guide.
## What Is the Best Way to Convert Markdown to Word?
Pandoc is the gold standard for Markdown to Word conversion. It handles the full CommonMark specification — tables, fenced code blocks, footnotes, blockquotes, images, and nested lists — and maps each element to the appropriate Word paragraph style. Every other method is either a wrapper around Pandoc or a less capable alternative.
The choice of method depends on your workflow:
| Method | Best for | Requires | Privacy |
|--------|----------|----------|---------|
| Pandoc (CLI) | Any workflow, full control | Terminal, Homebrew | Local — no upload |
| VS Code + extension | Writers who live in VS Code | Pandoc installed | Local |
| Online converter | One-off conversions, no CLI | Browser | Uploads your content |
| Python (python-docx) | Programmatic/pipeline use | Python environment | Local |
| Copy-paste from preview | Very simple documents only | Nothing | Local |
For most users, Pandoc is the answer. The others are situational.
## How Do You Install Pandoc on macOS?
Pandoc installs in one command via Homebrew. Open Terminal and run:
```bash
brew install pandoc
```
Homebrew downloads and installs the Pandoc binary globally. Verify the installation:
```bash
pandoc --version
```
You should see output like `pandoc 3.x.x`. No additional dependencies are needed for `.md` to `.docx` conversion — Pandoc handles everything natively.
If you do not have Homebrew, install it first:
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
Alternatively, download the macOS `.pkg` installer from [pandoc.org/installing](https://pandoc.org/installing.html) if you prefer not to use Homebrew.
## How Do You Convert Markdown to Word with Pandoc?
The basic conversion is a single command. Navigate to the folder containing your Markdown file and run:
```bash
pandoc input.md -o output.docx
```
Pandoc infers the output format from the file extension. The result is a `.docx` file in the same directory, with Word paragraph styles applied automatically:
- `# Heading 1` → Word **Heading 1** style
- `## Heading 2` → Word **Heading 2** style
- Paragraphs → Word **Normal** style
- ` ```code``` ` blocks → Word **Verbatim** style (monospace)
- `| table |` → Word table with borders
- `> blockquote` → Word **Block Text** style
### Converting multiple files at once
Pandoc accepts multiple input files and concatenates them:
```bash
pandoc chapter1.md chapter2.md chapter3.md -o book.docx
```
### Specifying the input format explicitly
If your file uses a non-standard extension, specify the format:
```bash
pandoc input.txt -f markdown -o output.docx
```
The `-f markdown` flag tells Pandoc to parse the input as CommonMark Markdown regardless of the file extension.
## How Do You Apply a Custom Word Template with Pandoc?
For corporate documents, you need the output to match your organisation's heading styles, fonts, and paragraph formatting. Pandoc supports this via a reference `.docx` file:
```bash
pandoc input.md --reference-doc=template.docx -o output.docx
```
Pandoc reads the styles from `template.docx` and applies them to the converted content. It copies the **style definitions** (fonts, colours, spacing) not the content — your Markdown text fills the document, styled according to your template.
### How to create the reference template
1. Open a blank `.docx` in Microsoft Word
2. Define the styles you need: **Heading 1**, **Heading 2**, **Normal**, **Verbatim** (for code), **Block Text** (for blockquotes)
3. Set your organisation's fonts, colours, and paragraph spacing for each style
4. Save the file as `template.docx`
5. Pass it to Pandoc with `--reference-doc=template.docx`
The reference doc approach is the standard workflow for organisations that publish Markdown internally but deliver Word documents to clients or regulators. It eliminates manual reformatting after conversion.
### Useful Pandoc flags for Word output
```bash
# Table of contents
pandoc input.md --toc -o output.docx
# Number headings (1.1, 1.2, etc.)
pandoc input.md --number-sections -o output.docx
# Combine template + TOC + numbered headings
pandoc input.md --reference-doc=template.docx --toc --number-sections -o output.docx
```
## Can You Convert Markdown to Word in VS Code?
VS Code does not export to `.docx` natively. However, the **vscode-pandoc** extension adds Pandoc integration directly to the editor. With it installed, you can open the command palette (`Cmd+Shift+P`) and run "Pandoc Document Exporter: Export as Word Document" without leaving VS Code.
**Requirements:** Pandoc must be installed on your system (see the Homebrew step above). The extension is a UI wrapper — it calls the same `pandoc` binary under the hood.
To install:
1. Open VS Code Extensions (`Cmd+Shift+X`)
2. Search for "vscode-pandoc" (by DougFinke)
3. Install and reload
4. Open your `.md` file, open the command palette, and run the export command
The extension also supports PDF and HTML export via the same command palette. If Pandoc is not found, the extension will prompt you to configure the binary path in VS Code settings.
> Note: The popular **Markdown All in One** extension (yzhang.markdown-all-in-one) does not export to `.docx`. It focuses on editing experience — shortcuts, table of contents, list formatting. Do not confuse the two.
## What Online Tools Convert Markdown to Word?
Online converters are suitable for one-off conversions when you do not want to install anything. The main options are:
**CloudConvert** (`cloudconvert.com`) — Supports Markdown to DOCX directly. Upload your `.md` file, select DOCX as output, and download the result. CloudConvert uses Pandoc under the hood. Free tier has conversion limits; paid plans available.
**Pandoc Online** (`pandoc.org/try`) — The official Pandoc demo converts between formats. Limited to smaller documents; not designed for production use.
**Word2MD / Markdown converters** — Several other tools exist, but most are Pandoc wrappers with varying rate limits and quality.
**[MacMD Markdown to Word converter](/tools/markdown-to-word)** — A free, browser-based converter that renders your `.md` and downloads a Word document entirely on your device. Unlike the options above, nothing is uploaded, so it works for confidential files too.
**Privacy tradeoff:** Most online converters upload your file content to a third-party server. For confidential documents — internal proposals, legal documents, client work — use Pandoc locally, or a browser-based converter that processes files on your device.
## How Do You Convert Markdown to Word with Python?
For programmatic conversion inside a pipeline or application, Python offers two approaches.
### Option 1: Call Pandoc as a subprocess (recommended)
```python
import subprocess
def markdown_to_docx(input_path: str, output_path: str, template_path: str | None = None) -> None:
cmd = ["pandoc", input_path, "-o", output_path]
if template_path:
cmd += ["--reference-doc", template_path]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
raise RuntimeError(f"Pandoc conversion failed: {result.stderr}")
markdown_to_docx("input.md", "output.docx", template_path="template.docx")
```
This approach has the same output quality as running Pandoc directly and avoids reimplementing conversion logic.
### Option 2: python-docx + markdown library
For cases where you cannot depend on a system Pandoc binary:
```bash
pip install python-docx markdown beautifulsoup4
```
```python
import markdown
from bs4 import BeautifulSoup
from docx import Document
def md_to_docx(md_text: str, output_path: str) -> None:
html = markdown.markdown(md_text, extensions=["tables", "fenced_code"])
soup = BeautifulSoup(html, "html.parser")
doc = Document()
for element in soup.children:
tag = getattr(element, "name", None)
if tag in ("h1", "h2", "h3"):
level = int(tag[1])
doc.add_heading(element.get_text(), level=level)
elif tag == "p":
doc.add_paragraph(element.get_text())
elif tag == "pre":
doc.add_paragraph(element.get_text(), style="No Spacing")
doc.save(output_path)
```
This approach gives you fine-grained control over the Word document structure but requires more code to handle every Markdown element correctly — tables, nested lists, inline formatting, images. For production use, the Pandoc subprocess approach is more reliable.
## What Markdown Features Do Not Convert to Word?
Most Markdown converts cleanly to Word via Pandoc. A few features have limitations worth knowing before you finalize your source document.
**Mermaid diagrams** — Pandoc does not render Mermaid. If your Markdown contains Mermaid fenced code blocks (` ```mermaid `), they appear as plain code blocks in the Word output. Workaround: export the diagram as a PNG from the [Mermaid live editor](https://mermaid.live) or from [MacMD Viewer](/blog/mermaid-live-editor-guide), then embed the image in your Markdown before converting. See the [Mermaid diagram guide](/blog/mermaid-live-editor-guide) for the full diagram syntax.
**Custom HTML** — Pandoc passes through raw HTML as plain text in `.docx` output. Any `
`, `
`, or custom styled elements are stripped or rendered as literal text. Rewrite HTML blocks as native Markdown before converting.
**Tables with complex alignment** — Basic Markdown tables (`| col | col |`) convert correctly. Tables with merged cells or complex column spans require post-conversion editing in Word.
**Inline math (LaTeX)** — Pandoc can handle `$equation$` syntax if you pass `--mathjax` or use the `--mathml` flag, but Word rendering of math varies. For documents with heavy math, consider [converting to PDF](/blog/markdown-to-pdf) instead, where LaTeX renders reliably.
**YAML frontmatter** — By default, Pandoc strips YAML frontmatter from the output body and uses it for document metadata. Fields like `title` and `author` can appear in the Word document header via a metadata block or a custom reference template.
## How Should You Preview Markdown Before Converting?
Converting to Word first and then catching formatting problems is expensive — fixing a broken table or missing heading in a `.docx` requires editing the Word file directly rather than the source Markdown.
A better workflow: preview the Markdown, catch and fix issues in the source, then convert once.
**[MacMD Viewer](https://macmdviewer.com/download)** renders your Markdown exactly as Pandoc will interpret it — GFM-compatible, with tables, code blocks, and nested lists all visible. Open the `.md` file in MacMD Viewer while editing in your text editor. The preview updates live, so you see broken syntax the moment you introduce it.
MacMD Viewer is not a converter — it does not produce Word or PDF output. Its role in the workflow is pre-conversion validation:
1. Write and edit your Markdown
2. Preview in MacMD Viewer — fix any table misalignment, heading hierarchy issues, or unrendered code blocks
3. Run `pandoc input.md -o output.docx` on the validated source
4. Open the `.docx` and verify styles
This approach produces a cleaner Word document and avoids the back-and-forth of editing Word files to fix source-level Markdown mistakes. ($19.99, one-time purchase, [download here](https://macmdviewer.com/download).)
## What Are the Limitations of Copy-Pasting from a Preview?
Copy-pasting rendered Markdown from a browser or preview pane into Word is the lowest-friction approach for short, simple documents. For anything with real structure, it breaks down quickly.
**What copy-paste preserves:** Basic bold and italic, paragraph breaks, plain bullet points.
**What copy-paste loses:** Heading styles (becomes bold Normal text instead of Word Heading styles), code block monospace formatting, table cell borders, blockquote indentation, and link URLs (the link text copies but not the href).
The result requires manual reformatting in Word to restore structure — which takes longer than just running Pandoc once. Use copy-paste only for documents under a page with minimal formatting.
## Markdown to Word: Method Comparison
| Method | Tables | Code blocks | Images | Custom styles | Mermaid | Privacy |
|--------|--------|-------------|--------|--------------|---------|---------|
| Pandoc CLI | Yes | Yes | Yes | Via template | No | Local |
| VS Code + vscode-pandoc | Yes | Yes | Yes | Via template | No | Local |
| CloudConvert | Yes | Yes | Yes | No | No | Uploaded |
| Python subprocess (Pandoc) | Yes | Yes | Yes | Via template | No | Local |
| python-docx (manual) | Partial | Partial | Yes | Yes (custom) | No | Local |
| Copy-paste from preview | Partial | Partial | No | No | No | Local |
Pandoc CLI is the winner for almost every use case. The reference template flag is the differentiator for professional document workflows.
## Frequently Asked Questions
### How do I convert Markdown to Word on macOS?
Install Pandoc with `brew install pandoc`, then run `pandoc input.md -o output.docx` in Terminal. This produces a Word document with correct heading styles, tables, and code blocks. For documents that need to match a corporate template, pass `--reference-doc=template.docx` to apply your organisation's styles.
### Does Pandoc preserve Markdown headings as Word heading styles?
Yes. Pandoc maps `# Heading 1` to the Word **Heading 1** paragraph style, `## Heading 2` to **Heading 2**, and so on through `###### Heading 6`. If you use a reference `.docx` template, Pandoc applies the font, colour, and spacing from your template's heading styles to the converted headings.
### Can I convert a Markdown file with images to Word?
Yes. Pandoc embeds images referenced in your Markdown (``) into the `.docx` file. Use relative paths from the Markdown file's directory. Remote image URLs also work, but Pandoc must be able to fetch them during conversion.
### What is the difference between Markdown to Word and Markdown to PDF?
Word (`.docx`) output is editable — recipients can modify the document, track changes, and comment. PDF output is a fixed layout, suitable for final deliverables that should not be edited. For Pandoc, the only difference is the output extension: `-o output.docx` versus `-o output.pdf` (PDF also requires a LaTeX distribution or `--pdf-engine=weasyprint`). See the [Markdown to PDF guide](/blog/markdown-to-pdf) for the full PDF workflow.
### Why does my converted Word document look unstyled?
Without a reference template, Pandoc applies its default Word styles, which use generic fonts and basic formatting. To get professionally styled output, create a reference `.docx` with your desired heading and paragraph styles, then pass it with `--reference-doc=your-template.docx`. The [Pandoc documentation](https://pandoc.org/MANUAL.html#option--reference-doc) explains how to configure each style in the template.
---
# How to Open an MD File: 5 Ways (Mac, Windows & Linux)
URL: https://macmdviewer.com/blog/how-to-open-md-file
Description: Learn how to open an MD file in seconds: 5 ways to view Markdown on Mac, Windows, and Linux, from a double-click to a fully rendered preview, free (2026).
Published: 2026-03-31
Updated: 2026-07-11
> **TL;DR:** An MD file is plain text — any text editor opens it. For a rendered preview with styled headings, tables, and code blocks, use VS Code (`Ctrl+Shift+V`), a native viewer like MacMD on macOS, or an online Markdown preview tool. This guide covers 5 methods across macOS, Windows, Linux, and the browser.
Claude Code or Codex wrote a `README.md` into your project, Cursor generated docs, ChatGPT handed you a plan, you cloned a repository, or a colleague sent you a README — and now you have a `.md` file to open. The good news: every operating system can open an MD file because it is plain text. The real question is whether you want to see raw syntax characters or a properly rendered document with styled headings, clickable links, and formatted code blocks.
GitHub hosts over 630 million repositories ([GitHub Octoverse, 2025](https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/)), and nearly every one contains at least one `.md` file. If you work with code, documentation, or technical writing, knowing how to open MD files quickly — and with the right tool — saves time every single day.
> **630 million repositories** on GitHub contain `.md` files for READMEs, changelogs, and documentation ([GitHub Octoverse, 2025](https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/)). Learning how to open an MD file correctly is a foundational skill for anyone working with modern software projects.
## What Is an MD File and Why Does It Need a Specific Opener?
An MD file is a plain-text document written in Markdown, the lightweight markup language created by John Gruber in 2004. The `.md` extension tells your system the file contains formatting syntax — characters like `#` for headings, `**` for bold, and `-` for lists — that a renderer converts into styled HTML.
The [CommonMark specification](https://spec.commonmark.org/0.31.2/) (version 0.31.2, January 2024) standardizes this syntax across more than 600 test cases. Any tool that follows CommonMark renders the same `.md` file identically, which is why Markdown became the default format for technical documentation.
Here is the catch: opening an MD file in Notepad or TextEdit shows the raw syntax, not the formatted output. You see `## Heading` instead of a styled heading and `[link](url)` instead of a clickable hyperlink. That raw view is useful for editing, but when you need to read or review a Markdown document, you need a tool that renders it. For a deeper explanation of the format itself, see the [guide to MD files](/blog/what-is-md-file-guide).
> The `.md` extension stands for Markdown, a plain-text formatting syntax standardized by the [CommonMark specification](https://spec.commonmark.org/0.31.2/) (version 0.31.2, 2024). Unlike binary formats like `.docx`, an MD file is readable in any text editor — but a dedicated viewer renders headings, tables, and code blocks as styled HTML.
## How Do You Open an MD File on macOS?
On macOS, you have two immediate choices: open the file as raw text in TextEdit, or render it as a document in a Markdown viewer. For the complete Mac-specific workflow—including Finder preview, default-app setup, and folders—use the dedicated [guide to opening `.md` files on Mac](/guides/how-to-open-md-files-on-mac).
### Method 1: TextEdit (built-in, raw view)
TextEdit ships with every Mac. It opens `.md` files but shows raw Markdown syntax without rendering.
1. Right-click the `.md` file in Finder.
2. Select **Open With** and choose **TextEdit**.
3. If the file appears with formatting artifacts, go to **Format > Make Plain Text** (`Shift+Cmd+T`).
This works for quick edits but is not ideal for reading documentation. You see `**bold**` as literal characters, not styled text.
### Method 2: Terminal commands (raw view)
For a fast glance at a file's contents without opening an editor:
```bash
cat README.md # Print the entire file
less README.md # Scroll through page by page
head -n 30 README.md # Show the first 30 lines
```
Terminal output is plain text — no rendering. But when I need to check a README before cloning a full project, `less` is the fastest option because I am already in the terminal.
### Method 3: MacMD Viewer (native rendered view)
A dedicated Markdown viewer renders the file as styled HTML with headings, tables, syntax-highlighted code blocks, and Mermaid diagrams. [MacMD Viewer](/features) ($19.99 one-time) is built specifically for this workflow on macOS:
1. Open MacMD Viewer or double-click any `.md` file (once MacMD is set as the default handler).
2. The file renders instantly with a clickable table of contents sidebar.
3. Edit the file in your preferred editor — MacMD watches for changes and refreshes the preview automatically.
MacMD also adds [QuickLook integration](/quicklook), which means you can press **Space** on any `.md` file in Finder to see a rendered preview without opening any application. That single feature eliminates the most common friction point: double-clicking an MD file and getting dumped into Xcode or a raw text editor.
> On macOS, double-clicking a `.md` file typically opens Xcode or TextEdit — neither renders Markdown formatting. A dedicated viewer like [MacMD Viewer](/download) registers as an MD file handler and adds QuickLook support, so pressing Space in Finder shows a fully rendered preview instantly.
## How Do You Open an MD File on Windows?
Windows does not recognize `.md` files natively, but several methods let you open and view them.
### Method 1: Notepad (built-in, raw view)
1. Right-click the `.md` file in File Explorer.
2. Select **Open with** and choose **Notepad**.
3. The file opens as plain text showing raw Markdown syntax.
Notepad works for quick edits but cannot render Markdown. For files with tables, code blocks, or diagrams, the raw view is difficult to follow. Windows 11 preview builds are adding basic Markdown syntax rendering to Notepad, including tables ([Medium](https://kurtis-redux.medium.com/notepad-in-windows-11-is-quietly-becoming-a-markdown-editor-656c1668c099), 2026) — a meaningful shift, but not yet a full viewer.
### Method 2: VS Code (free, rendered preview)
Visual Studio Code is the most popular code editor — used by 73% of developers according to the [Stack Overflow Developer Survey, 2024](https://survey.stackoverflow.co/2024/technology/#most-popular-technologies-new-collab-tools) — and it has built-in Markdown support.
1. Open VS Code and drag the `.md` file into the window, or use **File > Open File**.
2. Press `Ctrl+Shift+V` to open a rendered preview in a new tab.
3. Press `Ctrl+K V` to open a side-by-side view with source on the left and preview on the right.
VS Code renders headings, bold, italic, links, images, lists, and code blocks. For extended syntax like Mermaid diagrams or LaTeX math, install the [Markdown Preview Enhanced](https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced) extension.
### Method 3: Browser-based viewer (no install)
If you cannot install software, paste the file contents into an [online Markdown preview tool](/tools/markdown-preview) to see the rendered output immediately. No account or download required.
### Method 4: LibreOffice or Markdown View (rendered, native)
LibreOffice 26.2 (2026) added native Markdown import ([Heise](https://www.heise.de/en/news/LibreOffice-26-2-Faster-Markdown-Support-and-Better-Office-Compatibility-11165526.html), 2026) — open a `.md` file directly in LibreOffice Writer via **File > Open**. It is the first major office suite with built-in Markdown import, and it works on Windows, macOS, and Linux. For a lightweight Explorer-integrated option, Markdown View from the Microsoft Store renders `.md` files with themes and print support.
> VS Code is used by 73% of developers ([Stack Overflow Developer Survey, 2024](https://survey.stackoverflow.co/2024/technology/#most-popular-technologies-new-collab-tools)) and includes built-in Markdown preview. Press `Ctrl+Shift+V` on Windows to render any `.md` file instantly.
## How Do You Open an MD File on Linux?
On Linux, `glow README.md` gives a styled rendered view in the terminal; `cat` or `less` shows raw syntax with no install. For a GUI preview, VS Code with `Ctrl+Shift+V` works across major distributions.
### Terminal-based viewing
Most Linux systems have `cat`, `less`, or `bat` pre-installed or easily available:
```bash
cat README.md # Full file dump
less README.md # Paginated scrolling
bat README.md # Syntax-highlighted output (install via package manager)
```
The `bat` command is particularly useful — it applies syntax highlighting to the raw Markdown, making headings and code fences visually distinct even without full rendering.
### GUI text editors
- **gedit** (GNOME) — opens `.md` files as plain text with syntax highlighting.
- **Kate** (KDE) — includes a Markdown preview plugin that renders the file alongside the source.
- **Mousepad** (Xfce) — lightweight editor for raw Markdown viewing.
### VS Code on Linux
The same VS Code workflow applies on Linux. Install VS Code via your distribution's package manager or Snap store, open the `.md` file, and press `Ctrl+Shift+V` for the rendered preview.
### Dedicated terminal renderers
Tools like `glow` render Markdown directly in the terminal with styled output:
```bash
glow README.md # Renders Markdown with colors and formatting in the terminal
```
`glow` is open source ([charmbracelet/glow on GitHub](https://github.com/charmbracelet/glow)) and available via Homebrew, Snap, and most Linux package managers. Two related tools cover other needs: `mdcat` renders Markdown with inline images in supporting terminals (`brew install mdcat`), and `grip` opens a local server that previews the file in your browser with GitHub's exact styling (`pip install grip`).
> Linux users who open MD files frequently in the terminal should try `glow` or `bat` before installing a GUI tool. Both render Markdown with visual structure — `bat` adds syntax highlighting to the raw source, while `glow` produces fully styled output with colors, line wrapping, and heading hierarchy ([charmbracelet/glow, GitHub](https://github.com/charmbracelet/glow)).
## How Do You Open an MD File in a Web Browser?
You do not always need to install software. Two browser-based approaches work on any operating system.
### Drag and drop into the browser
Some browsers display `.md` files as raw text when you drag them into a browser window. This is functionally identical to opening them in Notepad — you see the source, not the rendered output.
### Use an online Markdown viewer
Online tools parse your Markdown and render it as styled HTML in real time. The [MacMD Markdown Preview tool](/tools/markdown-preview) lets you paste or type Markdown content and see the formatted result instantly. Other options include [StackEdit](https://stackedit.io/) and [Dillinger](https://dillinger.io/).
This approach is ideal for:
- Previewing a single file without installing anything.
- Viewing Markdown on a shared or locked-down machine.
- Quickly checking formatting before committing a README.
For viewing Markdown files regularly, a desktop viewer is faster and works offline. But for occasional use, a browser-based [MD file viewer](/tools/md-file-viewer) renders any `.md` file instantly with nothing to install and nothing uploaded. For a full comparison of dedicated apps across every platform, see the [best markdown viewer](/blog/best-markdown-viewer) roundup.
> Browser-based Markdown viewers require no installation and work on any operating system. They parse Markdown syntax client-side and render styled HTML in real time. The trade-off is that local file watching and offline access are unavailable — for daily use, a desktop viewer is more efficient.
## Which Method Should You Choose to Open an MD File?
Use VS Code if you already have it installed — it covers editing and previewing in one tool. On macOS, a dedicated viewer like MacMD ($19.99 one-time) is faster for read-only workflows because it renders files on double-click and adds QuickLook. For one-off checks, an online preview tool is the lowest-friction option. The full comparison:
| Scenario | Recommended method | Why |
|---|---|---|
| Quick edit on any OS | Text editor (Notepad, TextEdit, nano) | Already installed, opens instantly |
| Daily development work | VS Code with preview | Editing + rendering in one tool |
| Reading docs on macOS | [MacMD Viewer](/features) ($19.99 one-time) | Native rendering, QuickLook, file watching |
| One-off preview | Online Markdown preview | No install, works everywhere |
| Terminal workflow on Linux | `glow` or `bat` | Stays in the terminal, styled output |
If you open MD files more than a few times per week on a Mac, a dedicated viewer like MacMD Viewer ($19.99 one-time) pays for itself immediately. Once it's open, exporting is one shortcut away — see [how to convert Markdown to PDF on Mac](/blog/markdown-to-pdf-mac). The difference between reading raw `## Heading` syntax and seeing a properly styled document with a sidebar table of contents is the difference between deciphering code and reading a document.
## FAQ
### ChatGPT or Claude gave me a .md file — how do I open it?
Coding agents like Claude Code, Codex, and Cursor write `.md` (Markdown) files straight into your project — plans, READMEs, and summaries — because the format keeps headings, lists, tables, and code in portable plain text. (The web versions of ChatGPT and Claude usually render Markdown inline, so it is the CLI and agent tools that leave you a file to open.) Open it like any Markdown file: a text editor shows the raw text, a renderer shows it formatted. On macOS, press **Space** on the file in Finder with MacMD Viewer ($19.99) installed; on any OS, VS Code (`Ctrl/Cmd+Shift+V`) or an online Markdown preview tool renders it in seconds. What these tools generate is finished content meant to be read formatted — not a config file.
### Can I open an MD file on my phone?
Yes. On iOS, apps like [Working Copy](https://workingcopy.app/) (Git client with Markdown preview) and [iA Writer](https://ia.net/writer) render MD files. On Android, [Markor](https://github.com/gsantner/markor) is a free, open-source Markdown editor and viewer. You can also paste Markdown content into any browser-based preview tool from your phone.
### Why does my MD file open in Xcode on Mac?
macOS associates `.md` files with Xcode if it is installed, because Xcode registers itself as a handler for Markdown files. To change this: right-click any `.md` file in Finder, select **Get Info**, change the **Open with** dropdown to your preferred app (such as MacMD Viewer, $19.99 one-time), and click **Change All** to apply it to all `.md` files.
### Is an MD file the same as a TXT file?
Both are plain text, but an MD file contains Markdown formatting syntax that a renderer can convert to HTML. A `.txt` file has no formatting standard — it is raw text. Renaming a `.md` file to `.txt` does not change its content, but text editors will not apply Markdown syntax highlighting. For a detailed comparison, see [what is a Markdown file](/blog/what-is-markdown).
### Do I need internet access to open an MD file?
No. An MD file is a local plain-text document. Any text editor opens it offline. Desktop viewers like MacMD Viewer ($19.99 one-time) and VS Code also work entirely offline. Only browser-based online viewers require an internet connection.
### What is the difference between viewing and editing an MD file?
A viewer renders the Markdown as formatted HTML — read-only, no changes to the file. An editor lets you modify the content and often includes a live preview pane. If you only need to read documentation, a [dedicated MD file viewer](/blog/markdown-viewer-macos) is cleaner and faster than opening a full editor.
### What program opens a .md file?
Any text editor opens `.md` files as plain text — TextEdit on Mac, Notepad on Windows, Vim on Linux. For rendered viewing with formatted headings, code blocks, and diagrams, use a dedicated viewer like MacMD Viewer (Mac, $19.99 one-time), VS Code with preview (cross-platform, free), or `glow` in the terminal (free).
### Can Word or LibreOffice open a .md file?
Microsoft Word does not natively read Markdown — convert first with Pandoc: `pandoc file.md -o file.docx`. LibreOffice 26.2 (2026) added native Markdown import, so you can open `.md` files directly in LibreOffice Writer via **File > Open** on Windows, Mac, or Linux.
### Can Notepad read MD files?
Windows Notepad opens `.md` files as plain text, and Windows 11 preview builds are adding basic Markdown syntax rendering including tables. For full rendered viewing on Windows, use VS Code (free) or Markdown View from the Microsoft Store.
---
# HTML to Markdown: 6 Conversion Methods with Code (2026)
URL: https://macmdviewer.com/blog/html-to-markdown-guide
Description: Convert HTML to markdown using Turndown.js (3M+ weekly downloads, npm 2026), Pandoc, or Python. Six step-by-step methods with copy-paste code examples.
Published: 2026-03-31
Updated: 2026-05-29
How do you convert HTML to markdown? You feed your HTML source into a parser that reverses the tagging process -- stripping `