Skip to content

Commit 839f5fe

Browse files
committed
Sort syntax list case insensitive
1 parent 3b71a8e commit 839f5fe

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Use the [two-face](https://docs.rs/two-face) crate for an extended syntax
88
list.
99

10+
### Fixes
11+
12+
- Sort syntax list in case insensitive manner.
13+
1014

1115
## 2.7.1
1216

src/highlight.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ pub static DATA: LazyLock<Data> = LazyLock::new(|| {
3232
let paste = Hashed::new("paste", "js", include_str!("javascript/paste.js"));
3333
let syntax_set = two_face::syntax::extra_newlines();
3434
let mut syntaxes = syntax_set.syntaxes().to_vec();
35-
syntaxes.sort_by(|a, b| a.name.partial_cmp(&b.name).unwrap_or(Ordering::Less));
35+
syntaxes.sort_by(|a, b| {
36+
a.name
37+
.to_lowercase()
38+
.partial_cmp(&b.name.to_lowercase())
39+
.unwrap_or(Ordering::Less)
40+
});
3641

3742
Data {
3843
style,

0 commit comments

Comments
 (0)