All Projects → anthonygelibert → QLColorCode

anthonygelibert / QLColorCode

Licence: GPL-3.0 license
QuickLook plugin for source code with syntax highlighting.

Programming Languages

objective c
16641 projects - #2 most used programming language
CSS
56736 projects
c
50402 projects - #5 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to QLColorCode

vue-highlight-text
🔦 Vue component for highlight multiple instances of a word
Stars: ✭ 55 (-90.66%)
Mutual labels:  highlight
errata
Source code error pretty printing
Stars: ✭ 41 (-93.04%)
Mutual labels:  highlight
web-marker
a web page highlighter - Please star if you like this project
Stars: ✭ 51 (-91.34%)
Mutual labels:  highlight
nim.nvim
Nim plugin for NeoVim
Stars: ✭ 159 (-73.01%)
Mutual labels:  highlight
AVIFQuickLook
AVIF QuickLook plugin on macOS
Stars: ✭ 99 (-83.19%)
Mutual labels:  quicklook-plugin
Spotlight
Introductory walkthrough framework for iOS Apps
Stars: ✭ 45 (-92.36%)
Mutual labels:  highlight
go-highlight
A Go (Golang) code syntax highlighting library.
Stars: ✭ 20 (-96.6%)
Mutual labels:  highlight
hl-fill-column
Highlight fill column for emacs.
Stars: ✭ 16 (-97.28%)
Mutual labels:  highlight
xray
Hexrays decompiler plugin that colorizes and filters the decompiler's output based on regular expressions
Stars: ✭ 97 (-83.53%)
Mutual labels:  highlight
chalk
🖍️🎨Composable and simple terminal highlighting package for OCaml.
Stars: ✭ 29 (-95.08%)
Mutual labels:  highlight
svelte-typeahead
Accessible, fuzzy search typeahead component
Stars: ✭ 141 (-76.06%)
Mutual labels:  highlight
CodeEditorView
Code Editor UITextView
Stars: ✭ 20 (-96.6%)
Mutual labels:  highlight
JSONPreview
🎨 A view that previews JSON in highlighted form, it also provides the ability to format and collapse nodes.
Stars: ✭ 21 (-96.43%)
Mutual labels:  highlight
QuickLook.Plugin.HelixViewer
A plugin for viewing 3D models with QuickLook (Beta)
Stars: ✭ 67 (-88.62%)
Mutual labels:  quicklook-plugin
prism-pretty
A Chrome Extension to format/highlight/preview HTML/JS/CSS/Markdown code with Prism.js
Stars: ✭ 91 (-84.55%)
Mutual labels:  highlight
Studyit-club
​💔 ​针对校社团开发的一套IT俱乐部官网 -> http://sunhang.gz01.bdysite.com/
Stars: ✭ 17 (-97.11%)
Mutual labels:  highlight
pdf-annotation-service
Client and service for embedding highlights into PDF documents
Stars: ✭ 32 (-94.57%)
Mutual labels:  highlight
texthighlighter
a no dependency typescript npm package for highlighting user selected text
Stars: ✭ 17 (-97.11%)
Mutual labels:  highlight
ReceiptQuickLook
A QuickLook plugin to inspect App Store receipts.
Stars: ✭ 35 (-94.06%)
Mutual labels:  quicklook-plugin
enhanced-slack
🌴 PoC Slack enhancer/injector
Stars: ✭ 48 (-91.85%)
Mutual labels:  highlight

QLColorCode

Build Status

Original project: http://code.google.com/p/qlcolorcode/

This is a Quick Look plug-in that renders source code with syntax highlighting, using the Highlight library.

To install the plug-in, just drag it to ~/Library/QuickLook. You may need to create that folder if it doesn't already exist.

Alternatively, if you use Homebrew Cask, install with brew install --cask qlcolorcode. Also available on MacPorts: port install QLColorCode.

To build the project, you must have Boost headers on your system in /opt/local/include or /usr/local/include.

Settings

If you want to configure QLColorCode, there are several defaults commands that could be useful:

Setting the text encoding (default is UTF-8). Two settings are required. The first sets Highlight's encoding, the second sets Webkit's:

defaults write org.n8gray.QLColorCode textEncoding UTF-16
defaults write org.n8gray.QLColorCode webkitTextEncoding UTF-16

Setting the font (default is Menlo):

defaults write org.n8gray.QLColorCode font Monaco

Setting the font size (default is 10):

defaults write org.n8gray.QLColorCode fontSizePoints 9

Setting the color style for light and dark mode (see all available themes):

defaults write org.n8gray.QLColorCode lightTheme solarized-light
defaults write org.n8gray.QLColorCode darkTheme solarized-dark

Setting the thumbnail color style (deactivated by default):

defaults write org.n8gray.QLColorCode hlThumbTheme ide-xcode

Setting the maximum size (in bytes, deactivated by default) for previewed files:

defaults write org.n8gray.QLColorCode maxFileSize 1000000

zSetting any extra command-line flags for Highlight (see below):

defaults write org.n8gray.QLColorCode extraHLFlags '-l -W'

Here are some useful 'highlight' command-line flags (from the man page):

   -F, --reformat=<style>
          reformat output in given style.   <style>=[ansi,  gnu,  kr,
          java, linux]

   -J, --line-length=<num>
          line length before wrapping (see -W, -V)

   -j, --line-number-length=<num>
          line number length incl. left padding

   -l, --line-numbers
          print line numbers in output file

   -t  --replace-tabs=<num>
          replace tabs by num spaces

   -V, --wrap-simple
          wrap long lines without indenting function  parameters  and
          statements

   -W, --wrap
          wrap long lines

   -z, --zeroes
          fill leading space of line numbers with zeroes

   --kw-case=<upper|lower|capitalize>
          control case of case insensitive keywords

It is also possible to have the HTML preview converted to RTF. Using RTF allows the contents of the file to be displayed instead of an icon -- similar to QLStephen.

defaults write org.n8gray.QLColorCode rtfRender true

Additional information

Additional features

Decompile

QLColorCode decompiles some formats:

  • Compiled AppleScript. It requires osadecompile installed at /usr/bin/osadecompile.
  • Binary PLIST. It requires plutil installed at /usr/bin/plutil.

Highlight

Plug-ins

QLColorCode enables some Highlight plug-ins :

  • In all languages: outhtml_codefold and reduce_filesize.
  • Java (sources and classes): java_library.
  • C/C++: cpp_syslog, cpp_ref_cplusplus_com and cpp_ref_local_includes.
  • Perl: perl_ref_perl_org.
  • Python: python_ref_python_org.
  • Shell: bash_functions.
  • Scala: scala_ref_scala_lang_org.

Handled languages

Highlight can handle lots and lots of languages, but this plug-in will only be invoked for file types that the OS knows are type "source-code". Since the OS only knows about a limited number of languages, I've added Universal Type Identifier (UTI) declarations for several "interesting" languages. If I've missed your favorite language, take a look at the Info.plist file inside the plug-in bundle and look for the UTImportedTypeDeclarations section. I haven't added all the languages that Highlight can handle because it's rumored that having two conflicting UTI declarations for the same file extension can cause problems. Note that if you do edit the Info.plist file you need to nudge the system to tell it something has changed. Moving the plug-in to the desktop then back to its installed location should do the trick.

As an aside, by changing colorize.sh you can use this plug-in to render any file type that you can convert to HTML. Have fun, and let me know if you do anything cool!

Adding Language Types

If QLColorCode doesn't display PHP and JavaScript code properly, their types may need to be added to Info.plist. Finding the right type string to use is the tricky part. Getting the type strings and getting Info.plist edits to take effect is easy by following the steps below, which explain how to add support for PHP:

  1. In Terminal.app (or any shell prompt), enter the command:
mdls -name kMDItemContentType /full/path/to/file.php

Use the path to any PHP file. The response will be:

kMDItemContentType = "public.php-script"

The string public.php-script is the type string needed in a later step.

  1. Again at a shell prompt, enter the command:
open ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Info.plist

This will open Info.plist in Xcode.app.

  1. In Xcode.app's edit window for Info.plist, go to:

Document types > Item 0 > Document Content Type UTIs

(If the editor is showing raw keys, that's: CFBundleDocumentTypes > Item 0 > LSItemContentTypes)

  1. Add an item for public.php-script, the type string found in the first step.
  2. Save the updated Info.plist file.
  3. Try it in Finder. (It's usually unnecessary to move/return the QLColorCode extension, restart QuickLook, or restart the Finder, but it wouldn't be surprising that some users might need to do so.)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].