PreviewCode provides macOS QuickLook file previews and Finder icon thumbnails for more than 50 programming and scripting languages, header files, and data files.
It is not exhaustive, nor is it intended to be. It is, however, intended to support the most popular languages used by Mac-based developers, whether for use on a Mac or on other platforms.
Just run the host app once to register the extensions — you can quit the app as soon as it has launched. We recommend logging out of your Mac and back in again at this point. Now you can preview source code files using QuickLook (select an icon and hit Space), and Finder’s preview pane and Info panels.
You can disable and re-enable the Code Previewer and Code Thumbnailer extensions at any time in System Preferences > Extensions > Quick Look.
Open the main app and click on Show Preview Preferences, or select Preferences... from the PreviewCode menu.
You can select from a range of text sizes, choose a monospace font, select the font’s style — regular, bold, italic, etc. — choose your preferred line spacing, and pick which theme you would like previews to use. One hundred themes are included, and you can view all of them, or just dark or light ones.
PreviewCode will allow you to select a dark theme or a light one. These will be applied whatever UI mode your Mac is set to. If you select auto mode, you choose two themes, one light, the other dark. These will be applied automatically based on the current UI mode.
.actionscript
).ads
, .adb
).applescript
).arduino
, .ino
).basic
, .bas
).brainfuck
, .b
, .bf
).c
, .h
).cpp
, .hpp
).csx
, .cs
, .c-sharp
, .csharp
).clojure
, .clj
, .cljc
, .cljs
).coffee
, .coffeescript
, .litcoffee
).dart
).elxir
, .ex
, .exs
).elm
).erlang
, .erl
, .hrl
).for
).fsharp
, .f-sharp
, .fsi
, .fsx
, .fsscript
).go
).gml
).haskell
, .hs
, .lhs
).java
).js
).julia
, .jl
).kotlin
, .kt
, .ktm
, .kts
).lisp
, .lsp
, .fasl
).lua
).m
).pas
).perl
).php
).py
).rb
).rs
, .rust
).swift
).typescript
, .tsx
).vbscript
, .vbe
, .vbs
, .wsc
, .wsf
).vue
).sh
).csh
).ksh
).tsch
).zsh
).s
).asm
, .nasm
).asciidoc
, .adoc
, .asc
).conf
, .cf
, .cfg
, .ini
, .rc
).cmake
).css
).env
).latex
, .tex
)makefile
).plist
).entitlements
).xib
).storyboard
).proto
).scss
, .sass
).sql
).tf
, .terraform
).tfvars
).twig
).edn
files. This is because the .edn
file extension is pre-set on macOS to an Adobe digital rights management product..ts
files. This is because the .ts
file extension is pre-set on macOS to MPEG-2 transport stream video files. The .tsx
and .typescript
extensions are supported..exs
files if GarageBand and/or Logic Pro is installed on your Mac. This is because these apps use this file extension for EXS24 instrument files.This repository contains the primary source code for PreviewCode. Certain graphical assets, code components and data files are not included. To build PreviewCode from scratch, you will need to add these files yourself or remove them from your fork.
The files REPLACE_WITH_YOUR_FUNCTIONS
and REPLACE_WITH_YOUR_CODES
must be replaced with your own files. The former will contain your sendFeedback(_ feedback: String) -> URLSessionTask?
function. The latter your Developer Team ID, used as the App Suite identifier prefix.
You will need to generate your own Assets.xcassets
file containing the app icon, app_logo.png
and theme screenshots.
You will need to create your own new
directory containing your own new.html
file.
PreviewCode makes use of HighlighterSwift which provides a Swift wrapper for Highlight.js and is derived from Highlightr.
com.microsoft.typescript
UTI..elm
Elm files..scpt
binary applescript files..gml
GML (GameMaker Language) files..vue
Vue.js files..entitlements
, .xib
, .storyboard
Xcode files.com.microsoft.c-sharp
UTI.public.lua-script
UTI..plist
files..cs
C# extension..env
files..cmake
files..tfvars
files..adoc
, .asciidoc
and .asc
files..conf
, .cf
, .cfg
, .ini
and .rc
config files.hsl
extension..nasm
preview..actionscript
to avoid clash with AppleSingle .as
..cl
— clash with OpenCL source..l
— clash with Lex source..fs
— clash with OpenGL Fragment Shader source..dylan
and .lid
extensions..tf
files.Primary app code and UI design © 2024, Tony Smith.
Code portions © 2016 Juan Pablo Illanes.
Code portions © 2006-22 Ivan Sagalaev.