Skip to content

Commit

Permalink
Added check for a '.mdqlstyle.css' file in home directory (~), use fo…
Browse files Browse the repository at this point in the history
…r preview if it exists. Ignores if the file isn't there.
  • Loading branch information
ttscoff committed Mar 19, 2012
1 parent abff3a7 commit 61e3be5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MultiMarkdown QuickLook/GeneratePreviewForURL.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
// if (plainText == nil)
// plainText = [NSString stringWithContentsOfFile:[url path] usedEncoding:<#(NSStringEncoding *)#> error:<#(NSError **)#> encoding:NSASCIIStringEncoding];




NSString *theData = [NSString stringWithContentsOfFile:[url path] usedEncoding:&encoding error:nil];
NSString *cssDir = @"~/.mdqlstyle.css";
if ([[NSFileManager defaultManager] fileExistsAtPath:[cssDir stringByExpandingTildeInPath]]) {
NSString *cssStyle = [NSString stringWithFormat:@"\n<style>%@</style>",[NSString stringWithContentsOfFile:[cssDir stringByExpandingTildeInPath] encoding:NSUTF8StringEncoding error:nil]];
theData = [theData stringByAppendingString:cssStyle];
}

if (logDebug)
NSLog(@"Used %lu encoding",(unsigned long) encoding);
Expand Down

0 comments on commit 61e3be5

Please sign in to comment.