Skip to content

Commit ca70b8f

Browse files
authored
Merge pull request #243 from helmet91/bump-dependency-versions
Bump versions of some dependencies
2 parents a9af78b + 64d0798 commit ca70b8f

File tree

3 files changed

+70
-52
lines changed

3 files changed

+70
-52
lines changed

Cargo.lock

Lines changed: 56 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ required-features = ["clap", "syntect"]
2222
doc = false
2323

2424
[dependencies]
25-
typed-arena = "1.4.1"
25+
typed-arena = "2.0.1"
2626
regex = "1.5.5"
2727
once_cell = "1.13.0"
2828
entities = "1.0.1"
2929
unicode_categories = "0.1.1"
30-
clap = { version = "2.32.0", optional = true, features = ["wrap_help"] }
30+
clap = { version = "2.34.0", optional = true, features = ["wrap_help"] }
3131
memchr = "2"
3232
pest = "2"
3333
pest_derive = "2"
@@ -46,7 +46,7 @@ default = ["clap", "syntect"]
4646
xdg = "^2.1"
4747

4848
[target.'cfg(target_arch="wasm32")'.dependencies]
49-
syntect = { version = "4.6", optional = true, default-features = false, features = ["default-fancy"] }
49+
syntect = { version = "5.0", optional = true, default-features = false, features = ["default-fancy"] }
5050

5151
[target.'cfg(not(target_arch="wasm32"))'.dependencies]
52-
syntect = { version = "4.6", optional = true, default-features = false, features = ["assets", "dump-load", "html", "regex-onig"] }
52+
syntect = { version = "5.0", optional = true, default-features = false, features = ["default-themes", "default-syntaxes", "html", "regex-onig"] }

src/plugins/syntect.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ impl<'a> SyntectAdapter<'a> {
2828

2929
fn gen_empty_block(&self) -> String {
3030
let syntax = self.syntax_set.find_syntax_by_name("Plain Text").unwrap();
31-
highlighted_html_for_string(
31+
match highlighted_html_for_string(
3232
"",
3333
&self.syntax_set,
3434
syntax,
3535
&self.theme_set.themes[self.theme],
36-
)
36+
) {
37+
Ok(empty_block) => empty_block,
38+
Err(_) => "".into(),
39+
}
3740
}
3841

3942
fn remove_pre_tag(&self, highlighted_code: String) -> String {
@@ -69,12 +72,15 @@ impl SyntaxHighlighterAdapter for SyntectAdapter<'_> {
6972
.unwrap_or_else(|| self.syntax_set.find_syntax_plain_text())
7073
});
7174

72-
self.remove_pre_tag(highlighted_html_for_string(
75+
match highlighted_html_for_string(
7376
code,
7477
&self.syntax_set,
7578
syntax,
7679
&self.theme_set.themes[self.theme],
77-
))
80+
) {
81+
Ok(highlighted_code) => self.remove_pre_tag(highlighted_code),
82+
Err(_) => code.into(),
83+
}
7884
}
7985

8086
fn build_pre_tag(&self, attributes: &HashMap<String, String>) -> String {

0 commit comments

Comments
 (0)