Martin Pittenauer of The Coding Monkeys, tired of looking at poorly formatted source directly in Apple’s Safari web browser cooked up a small hack which instead hijacks Safari’s source view and instead displays it in SubEthaEdit. He was also good enough to post the source code for this making it possible to change it, allowing the source to be viewed in applications other than SubEthaEdit.
While I think SubEthaEdit is really cool, it’s not my primary editor. I’m a BBEdit man myself as are many of my contemporaries. And so out of SubEthaFari comes my switched-up bundle renamed (for lack of a better idea at the time), “BBEditSource”.
Why is this useful you ask? The answers should be at least partly obvious. Automatic syntax colouring, line numbers, and the ability to sort out rendering problems and code validation (especially if you use a lot of includes and need to be able to figure out if there are missing tags and such).
Being the responsible developer I strive to be, I’ve made the bundle available for download along with my modified source code. The download links are available at the end of this post.
Installation Notes
BBEditSource can be installed in two different locations in Mac OS X, your Library folder or within the system-level Library folder found at the root level of your hard drive where it will be available to all users on the system.
BBEditSource is known to work in Safari 1.2 and the 1.3 Developer Beta. It’s possible that it may work in earlier versions no access to those versions currently limits my ability to test again this theory to deny or confirm it. Your mileage may vary.
Note that you should not have SubEthaFari and BBEditSource installed at the same time to avoid potential conflicts. If you are experiencing problems or unexplained crashes using BBEditSource, leave a post in the comments.
- Create a new folder called InputManagers inside the ~/Library folder or in /Library/ at the root level of your computer.
- Drag the folder named “BBEditSource” to the InputManagers folder to install the bundle.
- Launch Safari and visit a web site. In the View menu, choose View Source. The source code should be displayed inside a local copy of BBEdit instead of within Safari.
Downloads
Files are available for download as compressed Stuffit (.sit) archives. Click on the link to download the files to your Desktop. The source code has been saved in Xcode 1.2 format and may not be fully compatible with older versions. Visit Apple’s Developer Connection web site to download the latest version of Xcode for Mac OS X (free).
Download BBEditSource 1.0 (.sit file) and Xcode Source project (.sit file)
So say you…
Doesn’t seem to work for me - I get an app appear in my dock for a brief period of time (couple of seconds) - then nothing - I’ve tried with BBEdit open, and with it not - neither helps.
I have it installed in /Library, but have tried in ~/Library too.
Any help would be appreciated.
Isaac August 2, 2004
@Issac — One thing I forgot to mention is that it requires BBEdit 7.x in order to work. I’ve had someone else test this before with an earlier version (6.5) and it didn’t work. It likely will not work if you’ve renamed the BBEdit application. The enclosing folder may be renamed or moved but the application must be named “BBEdit”.
Scott August 2, 2004
Hate to break it to you, but I’ve got the latest version of BBEdit, and it hasn’t been renamed.
Isaac August 2, 2004
Very strange.
When my coworker first reported to me that it didn’t work, I thought perhaps he had installed it in the wrong place or that it required the SIMBL frameworks or the DebugMenu be enabled, but none of those appeared to be the case.
Do you have another user account on the computer you can try it with. It’s possible that it’s related to a LaunchServices preference problem. I’ve had BBEdit do that to me in the past as well (it appears to launch under Classic and then dies).
Scott August 2, 2004
You’re right on with it briefly trying to launch the classic version of BBEdit - once you pointed that out - I recognized the icon that briefly appeared on my dock.
No luck with a different account on my computer — I’m going to try it on another machine tomorrow, and see if it helps any.
Isaac August 2, 2004
I’m having the same problem.
Jeff August 2, 2004
Works just fine for me. Thanks, Scott.
Phil Sherry August 3, 2004
If the bundle still does not work after attempting to use it in a “clean” user account, then there’s likely something at the computer-level rather than the user level that is causing problems. As I mentioned previously, LaunchServices can often be the culprit of such problems.
I’m not really too sure what to suggest aside from clearing caches in /Library and /System/Library. You may also want to look at removing the com.apple.loginwindow.plist and the loginwindow.plist files from the /Library/Preferences folder and letting the system build new ones.
Scott August 3, 2004
I cleared both of the “Caches” folders and also removed the two plist files that you mentioned then restarted Safari but unfortunately it’s still flashing the BBEdit icon in the dock then disappearing.
Thanks for your help in troubleshooting the problem. If I end up finding a solution I’ll be sure to post it.
Jeff August 3, 2004
Cool. Thanks Jeff. I know I’ve solved this before, I just can’t remember what it was that I did. I thought it was just clearing caches and prefs.
If you don’t use Classic at all, I think you can get away with viewing the contents of the BBEdit.app and removing the BBEdit.app/Contents/MacOSClassic folder which is where the Classic version lives. It’s a bit of a brute force method, but it might work.
Keep in mind that it will be replaced following the next BBEdit update.
Scott August 3, 2004
Removing the classic version doesn’t work either — if anyone else fixes this, or has an idea, please post it.
For now I’ve just started using the SubEthaFari version but would love to be able to use the BBEdit one instead.
Isaac August 5, 2004
If you’re just looking for source-syntax colouring, check out SafariStand, a plugin for Safari.
It should be placed in /Library/InputManagers/ to function and, although the page is in Japanese, the installed product is in a (oddly, but good for the most part) translated english.
From hicksdesign, the full function list is:
It also seems to add Copy Link HTML Tag command to the context menu when ctrl-clicking links.
SafariStand is freeware and can be downloaded from http://hetima.com/safari/stand.html
Will Croft August 10, 2004