Skip to content

Commit ce9b67d

Browse files
committed
Support for the .rmd fenced source code blocks.
1 parent 476e366 commit ce9b67d

File tree

6 files changed

+46
-15
lines changed

6 files changed

+46
-15
lines changed

CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Changelog
22
=======
33

4-
5-
### 1.0.1
4+
### 1.0.2 (27)
5+
Bugfix:
6+
- Fenced code block highlighted even when rmd syntax is used (language name inside a curly brace).
7+
8+
### 1.0.1 (26)
69
New features:
710
- With `YAML` and `table` extensions enabled, the `yaml` file header is displayed as a table.
811

QLMarkdown.xcodeproj/project.pbxproj

+8-8
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@
11841184
CODE_SIGN_ENTITLEMENTS = QLExtension/QLExtension.entitlements;
11851185
CODE_SIGN_IDENTITY = "-";
11861186
CODE_SIGN_STYLE = Manual;
1187-
CURRENT_PROJECT_VERSION = 26;
1187+
CURRENT_PROJECT_VERSION = 27;
11881188
DEVELOPMENT_TEAM = "";
11891189
ENABLE_HARDENED_RUNTIME = NO;
11901190
HEADER_SEARCH_PATHS = (
@@ -1205,7 +1205,7 @@
12051205
"$(PROJECT_DIR)/re2",
12061206
);
12071207
MACOSX_DEPLOYMENT_TARGET = 10.15;
1208-
MARKETING_VERSION = 1.0.1;
1208+
MARKETING_VERSION = 1.0.2;
12091209
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.QLMarkdown.QLExtension;
12101210
PRODUCT_NAME = "$(TARGET_NAME)";
12111211
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1222,7 +1222,7 @@
12221222
CODE_SIGN_ENTITLEMENTS = QLExtension/QLExtension.entitlements;
12231223
CODE_SIGN_IDENTITY = "-";
12241224
CODE_SIGN_STYLE = Manual;
1225-
CURRENT_PROJECT_VERSION = 26;
1225+
CURRENT_PROJECT_VERSION = 27;
12261226
DEVELOPMENT_TEAM = "";
12271227
ENABLE_HARDENED_RUNTIME = NO;
12281228
HEADER_SEARCH_PATHS = (
@@ -1243,7 +1243,7 @@
12431243
"$(PROJECT_DIR)/re2",
12441244
);
12451245
MACOSX_DEPLOYMENT_TARGET = 10.15;
1246-
MARKETING_VERSION = 1.0.1;
1246+
MARKETING_VERSION = 1.0.2;
12471247
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.QLMarkdown.QLExtension;
12481248
PRODUCT_NAME = "$(TARGET_NAME)";
12491249
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1379,7 +1379,7 @@
13791379
CODE_SIGN_IDENTITY = "-";
13801380
CODE_SIGN_STYLE = Manual;
13811381
COMBINE_HIDPI_IMAGES = YES;
1382-
CURRENT_PROJECT_VERSION = 26;
1382+
CURRENT_PROJECT_VERSION = 27;
13831383
DEVELOPMENT_TEAM = "";
13841384
ENABLE_HARDENED_RUNTIME = NO;
13851385
FRAMEWORK_SEARCH_PATHS = (
@@ -1405,7 +1405,7 @@
14051405
"$(PROJECT_DIR)/re2",
14061406
);
14071407
MACOSX_DEPLOYMENT_TARGET = 10.15;
1408-
MARKETING_VERSION = 1.0.1;
1408+
MARKETING_VERSION = 1.0.2;
14091409
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.QLMarkdown;
14101410
PRODUCT_NAME = "$(TARGET_NAME)";
14111411
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1426,7 +1426,7 @@
14261426
CODE_SIGN_IDENTITY = "-";
14271427
CODE_SIGN_STYLE = Manual;
14281428
COMBINE_HIDPI_IMAGES = YES;
1429-
CURRENT_PROJECT_VERSION = 26;
1429+
CURRENT_PROJECT_VERSION = 27;
14301430
DEVELOPMENT_TEAM = "";
14311431
ENABLE_HARDENED_RUNTIME = NO;
14321432
FRAMEWORK_SEARCH_PATHS = (
@@ -1452,7 +1452,7 @@
14521452
"$(PROJECT_DIR)/re2",
14531453
);
14541454
MACOSX_DEPLOYMENT_TARGET = 10.15;
1455-
MARKETING_VERSION = 1.0.1;
1455+
MARKETING_VERSION = 1.0.2;
14561456
PRODUCT_BUNDLE_IDENTIFIER = org.sbarex.QLMarkdown;
14571457
PRODUCT_NAME = "$(TARGET_NAME)";
14581458
PROVISIONING_PROFILE_SPECIFIER = "";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "appearance.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"preserves-vector-representation" : true,
14+
"template-rendering-intent" : "template"
15+
}
16+
}
Binary file not shown.

QLMarkdown/Base.lproj/Main.storyboard

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
6-
<plugIn identifier="com.apple.WebKit2IBPlugin" version="17701"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19162"/>
6+
<plugIn identifier="com.apple.WebKit2IBPlugin" version="19162"/>
77
<capability name="Named colors" minToolsVersion="9.0"/>
88
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
99
</dependencies>
@@ -1777,8 +1777,8 @@
17771777
</connections>
17781778
</button>
17791779
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1nt-58-sRk">
1780-
<rect key="frame" x="968" y="10" width="15" height="15"/>
1781-
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="style_dark15" imagePosition="only" alignment="center" alternateImage="style_light15" state="on" inset="2" id="mrl-iS-3hF">
1780+
<rect key="frame" x="967" y="9" width="16" height="16"/>
1781+
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="appearance" imagePosition="only" alignment="center" state="on" inset="2" id="mrl-iS-3hF">
17821782
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
17831783
<font key="font" metaFont="system"/>
17841784
</buttonCell>
@@ -2545,6 +2545,7 @@ Gw
25452545
<image name="ThemeOrigin_All_Normal" width="15" height="15"/>
25462546
<image name="ThemeOrigin_Custom_Normal" width="15" height="15"/>
25472547
<image name="ThemeOrigin_Standalone_Normal" width="15" height="15"/>
2548+
<image name="appearance" width="16" height="16"/>
25482549
<image name="style_dark15" width="15" height="15"/>
25492550
<image name="style_light15" width="15" height="15"/>
25502551
<image name="style_mixed15" width="15" height="15"/>

highlight-wrapper/wrapper_highlight.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,17 @@ char *highlight_format_string2(const char *code, const char *language, int *exit
309309
suffix = "xml";
310310
} else if (suffix == "m" ) {
311311
suffix = "objc";
312+
} else if (suffix.front() == '{' && suffix.back() == '}') {
313+
// remove r-markdown curly braces
314+
std::size_t found1 = suffix.find_first_of(','); // arguments separator
315+
std::size_t found2 = suffix.find_first_of(' ');
316+
std::size_t found = min(found1, found2);
317+
if (found != std::string::npos) {
318+
suffix = suffix.substr(1, found - 1);
319+
} else {
320+
suffix.pop_back();
321+
suffix.erase(0, 1);
322+
}
312323
}
313324
generator->setFilesCnt(1);
314325

0 commit comments

Comments
 (0)