All articles

How to Preview Code, Markdown and ZIP Files With Quick Look on a Mac

· 6 min read

Select a Swift or Python file in the Finder and press the space bar: Quick Look shows the code as plain text, all in one color. A README.md shows its # and ** instead of headings and bold text. And a ZIP file shows its icon, name and size, but not one of the files inside.

Quick Look only shows what a preview installed on your Mac knows how to draw. The previews built into macOS treat code, JSON and Markdown as plain text, and none of them reads an archive. Since macOS Sequoia, the old plug-ins people used to fill that gap no longer load: better previews now come from Quick Look extensions that apps install. Folia Files includes one. With it, the space bar in the Finder and in Mail shows code with syntax colors and line numbers, JSON indented, Markdown rendered, and the list of files in a ZIP or TAR archive.

What Quick Look shows on its own

With nothing but macOS, pressing the space bar (or ⌘Y) on a file gives you:

  • Source code (Swift, Python, JavaScript, shell scripts…): plain text, no colors, no line numbers.
  • JSON: plain text as well, without colors.
  • Markdown: the raw text, with every #, * and [link](…) in view.
  • ZIP and TAR archives: the archive's icon, name and size, and nothing about its contents.

CSV files are the exception: macOS already shows them as a table.

Why: plug-ins were retired, extensions took over

Quick Look chooses a preview according to the file's type. macOS comes with its own previews for text, images, PDF, audio and video, Office and iWork documents, and a few others. To macOS, source code, JSON and Markdown are kinds of text, so they all get the plain-text preview, and no preview built into the system reads what an archive contains.

For years, you could add previews by dropping .qlgenerator plug-ins into the QuickLook folder of your Library. macOS Sequoia (15) stopped loading them, and previews installed that way disappeared. A new preview now has to be a Quick Look extension that comes inside an app: you install the app, and macOS uses its extension.

Two places tell you what is going on:

  • System Settings › General › Login Items & Extensions: in the Extensions section, Quick Look lists the preview extensions your apps installed, and lets you turn each one off.
  • Terminal: qlmanage -p ~/Desktop/README.md opens a file's preview the way the Finder shows it, and qlmanage -m plugins lists the previews built into macOS with the file types each one handles (extensions from apps don't appear there).

Folia Files' Quick Look extension

Folia Files is a file manager for the Mac, and it comes with a Quick Look extension. There is nothing else to install: once the app is in your Applications folder and you have opened it once, the space bar uses the extension wherever macOS shows Quick Look previews: in the Finder and on the Desktop, for attachments in Mail, and in other apps.

The screenshot below is taken inside Folia Files, in its Preview module; in the Finder, the extension gives the same colors to the same file, with line numbers in the margin.

Folia Files with the Swift sources of a project in a list and, in a pane on the right, the Preview module showing AtlasApp.swift with syntax colors

What it previews

  • Code: Swift, Python, JavaScript, Ruby, PHP, Perl, shell scripts, C and C++, Objective-C, Java, SQL, CSS, YAML and other languages macOS knows as source code. Keywords, strings, numbers, comments and type names each get a color, with line numbers in the margin, in light or dark mode like your Mac. Only the first 600 KB of a file are shown.
  • JSON: indented and colored, with keys sorted alphabetically, so their order may differ from the file's. A file that isn't valid JSON is shown as it is.
  • Markdown: rendered, with headings, bold and italics, bulleted, numbered and task lists, quotes, tables, code blocks and links.
  • ZIP and TAR archives, plain or compressed with gzip (.tar.gz, .tgz): the number of files and their total size once extracted, then each folder and file, indented, with the size of each file (up to the first 5,000 items).

For other archive formats, such as 7z or RAR, and for CSV files, macOS keeps its own preview.

A few file types slip through because macOS doesn't see them as code. TypeScript's .ts extension is also the one of MPEG transport stream videos, so macOS treats those files as video. Go or Rust files often have no type macOS recognizes, unless another app declares one. For these, the Finder keeps its usual preview.

Turn it off, or choose between two apps

In System Settings › General › Login Items & Extensions, the extension appears as Folia Files under Quick Look. Turn it off and macOS goes back to its own previews.

If another app on your Mac also has a Quick Look extension for Markdown or code, the Finder shows only one preview for a given file. To get the other one, turn off the extension you don't want in the same list.

The extension is part of both editions of Folia Files, the one from the website and the one from the Mac App Store.

Inside Folia Files: the same previews, with more room

In Folia Files itself, the space bar opens the app's own preview window for code, Markdown, JSON, CSV and archives; photos, PDFs, videos and other documents go to Quick Look as usual. The window floats over your panes: the arrow keys keep moving through the files and the preview follows, and the space bar closes it. This is the Folia Files previews for code, Markdown, JSON, CSV and archives (Space bar) setting, in Settings › Files and Network › Previews and Archives.

To keep a preview next to your files while you work, use the Preview module, one of Folia Files' modules: add it to the right sidebar with the sidebar's Modules button, or drag New Pane from the toolbar to the edge of the window and choose Preview in its grid. It shows whatever you select in the active pane.

Buttons at the top switch the view: Rendered, Source and Hex for Markdown, Formatted for JSON, Table for CSV, Contents for an archive. The colors and the Markdown rendering are the same as in the extension.

The Preview module of Folia Files showing Notes.md rendered, with a heading and a bulleted list, under the Rendered, Source and Hex buttons

Archives get one more option: double-click a ZIP in a Folia Files pane and it opens like a folder, read-only, so you can copy out only the files you need. How to open a ZIP file without extracting it shows how it works.

In short

  • Colored code, indented JSON, rendered Markdown and archive contents in the Finder and Mail: install Folia Files and open it once; the space bar does the rest.
  • macOS's own previews back: turn off Folia Files under Quick Look in System Settings › General › Login Items & Extensions.
  • A preview that stays open beside your files: the Preview module in Folia Files, in the right sidebar or in a pane of its own.