htmlmacosquicklook

quicklook html files as text, not rendered html?


OSX's Quicklook renders HTML (with the plugin /System/Library/Quicklook/Web.qlgenerator). I'd like to see plain text, as if I'd renamed the .html as .txt (that's not a solution and not only because it's awkward: I'm hoping that if the HTML rendering is turned off the code-coloring Quicklook plugin I use will kick in, and Quicklook will show me pretty HTML code).

I haven't been able to turn off HTML without killing Quicklook html support, which is what happens when I remove the plugin. I don't really know what I'm looking at in info.plist, but removing the public.html line is just as bad.

Tips?


Solution

  • This question is related to: https://apple.stackexchange.com/questions/51816/quicklook-html-plugin.

    Here is a solution that works (tested on Mac OS X 10.7.5):

    1. /install qlcolorcode (or qlstephen)

    2. Edit /System/Library/Quicklook/Web.qlgenerator/Contents/Info.plist and comment the two lines as below:

      <key>LSItemContentTypes</key>
      <array>
        <string>com.apple.webarchive</string>
        <!-- <string>public.html</string> -->
        <!-- <string>public.xhtml</string> -->
        <string>public.svg-image</string>
      </array>
      
    3. Add the two lines removed above under the same <key>LSItemContentTypes</key> into ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Info.plist (or ~/Library/QuickLook/QLStephen.qlgenerator/Contents/Info.plist)

    4. Press Command+Option+Esc and restart Finder.

    Now QuickLook should display the source code of HTML files (with syntax highlighting if you use qlcolorcode) instead of rendering them.