-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQLMarkdown.m
More file actions
23 lines (20 loc) · 789 Bytes
/
QLMarkdown.m
File metadata and controls
23 lines (20 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#import "QLMarkdown.h"
NSString* LoadBundleAndConvertText(NSString *text) {
NSBundle *ownBundle = [NSBundle bundleWithIdentifier:@"org.minuszero.qlgenerator.QLMarkdownPython"];
// NSLog(@"%@", ownBundle);
NSString *pyBundlePath = [ownBundle pathForResource:@"QLMarkdown" ofType:@"plugin"];
// NSLog(@"%@", pyBundlePath);
NSBundle *pyBundle = [NSBundle bundleWithPath:pyBundlePath];
// NSLog(@"%@", pyBundle);
[pyBundle load];
// NSLog(@"loaded pyBundle");
Class QLMarkdown = [pyBundle principalClass];
id markdown = [[QLMarkdown alloc] init];
NSString *htmlString = [markdown convertText:text];
[markdown release];
return htmlString;
}
NSString* ConvertURLToText(NSURL *url) {
NSString *text = [NSString stringWithContentsOfURL:url];
return LoadBundleAndConvertText(text);
}