MainspringGuides › Straight Quotes in Markdown
macOS Guide

Keep straight quotes in Markdown and code on Mac

Updated July 2026 · 3 min read

You're writing docs in Markdown, drop a fenced code block or a bit of YAML front matter, and macOS "helpfully" curls your quotes and turns -- into an en-dash — so the parser chokes and your rendered page shows the wrong characters. The fix is to switch off smart quotes and smart dashes, in System Settings → Keyboard → Text Input → Edit or with a quick defaults write, so every mark stays exactly as you typed it.

Keep quotes and dashes literal

  1. Open System Settings → Keyboard.
  2. In the Text Input section, click Edit….
  3. Turn off Use smart quotes and dashes.
  4. Click Done.

Quotes and dashes are the two conversions that ruin Markdown; both live under that single checkbox in Settings, and under two keys in Terminal:

# straight quotes: "key" stays "key", not curly
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# literal hyphens: -- stays --, not an en-dash
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false

# undo — re-enable both
defaults delete NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled
defaults delete NSGlobalDomain NSAutomaticDashSubstitutionEnabled

No logout is needed; relaunch the app you're writing in so it re-reads the setting. This works the same on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia.

Why Markdown specifically hates curly quotes

Prose is forgiving about typographic quotes; structured text is not. In a Markdown or docs workflow the damage is concrete:

Turning the setting off keeps what you type identical to what ships. When you genuinely want a real dash in prose, our guide to typing an em dash on Mac shows the deliberate keystroke.

Straight quotes, one toggle

Mainspring makes smart quotes and smart dashes labelled switches you flip off for writing and back on for prose — two of 90+ hidden macOS settings it turns into reversible toggles, so your Markdown stays byte-for-byte what you meant.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

Write in a plain-text editor too

Even a plain-text editor applies the system smart-quote setting, so turning it off globally is what actually fixes this — but a plain-text default keeps other rich-text surprises out of your notes. See how to make TextEdit default to plain text on Mac to pair with the change above.