Skip to content

Commit 0473fd7

Browse files
committed
Add MiniMessage syntax highlighting
1 parent df699e1 commit 0473fd7

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

astro.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import starlightLinksValidator from "starlight-links-validator";
66
import starlightSidebarTopics from "starlight-sidebar-topics";
77
import codeConstantsPlugin from "./src/utils/remark/code_const";
88
import javadocPlugin from "./src/utils/remark/javadoc";
9+
import miniMessageHighlight from "./src/assets/mm.tmLanguage.json";
910
import { LATEST_MC_RELEASE, LATEST_PAPER_RELEASE, LATEST_VELOCITY_RELEASE } from "./src/utils/versions";
1011

1112
const prod = process.env.NODE_ENV === "production";
@@ -426,6 +427,11 @@ export default defineConfig({
426427
],
427428
expressiveCode: {
428429
emitExternalStylesheet: false,
430+
shiki: {
431+
langs: [
432+
miniMessageHighlight
433+
]
434+
}
429435
},
430436
}),
431437
svelte(),

src/assets/mm.tmLanguage.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "mm",
4+
"patterns": [
5+
{
6+
"name": "meta.tag.mm",
7+
"begin": "(<)(/?)([a-zA-Z0-9_]+)",
8+
"beginCaptures": {
9+
"1": { "name": "constant.language.tag.mm" },
10+
"2": { "name": "constant.language.tag.mm" },
11+
"3": { "name": "constant.language.tag.mm" }
12+
},
13+
"end": "(>)",
14+
"endCaptures": {
15+
"1": { "name": "constant.language.tag.mm" }
16+
},
17+
"patterns": [
18+
{
19+
"name": "string.quoted.single.argument.mm",
20+
"match": "(:)'([^']*)'",
21+
"captures": {
22+
"1": { "name": "constant.language.tag.mm" },
23+
"2": { "name": "string.quoted.single.argument.mm" }
24+
}
25+
},
26+
{
27+
"name": "string.quoted.double.argument.mm",
28+
"match": "(:)\"([^\"]*)\"",
29+
"captures": {
30+
"1": { "name": "constant.language.tag.mm" },
31+
"2": { "name": "string.quoted.double.argument.mm" }
32+
}
33+
},
34+
{
35+
"name": "variable.language.argument.mm",
36+
"match": "(:)([^:\\s\"'>]+(?:\\[[^\\]]*\\])?)",
37+
"captures": {
38+
"1": { "name": "constant.language.tag.mm" },
39+
"2": { "name": "variable.language.argument.mm" }
40+
}
41+
}
42+
]
43+
}
44+
],
45+
"repository": {},
46+
"scopeName": "text.mm"
47+
}

src/content/docs/adventure/minimessage/format.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,35 @@ title: Format
33
---
44

55
*No point in converting this until the MiniMessage highlighter is fully figured out*
6+
7+
```mm
8+
<red>Hello World
9+
```
10+
11+
```mm
12+
<gold>Hey <bold>What's going?</gold>!
13+
```
14+
15+
```mm
16+
<gradient:red:blue>This is gradiented <bold>text</gradient>!
17+
```
18+
19+
```mm
20+
<gradient:#F253DE:#753EF8:#23B212:#42E0A8:#ADDE22:#F46AD7:#031F43:#E7DC65:#0C365E:#646BA0:#CCCDD5:#471DE4:#3393CB:#9CF810:#B1B7EB:#73D766:#E260DE:#1660A2:#A77FD8:#8826DB:#5B9A2B:#FC7570:#C6797E:#ECFC44:#86AC83:#D47484:#A0CD81>Scrop is most definitely a 14 year old girl</gradient>
21+
```
22+
23+
```mm
24+
Hello <selector:@e[limit=5]>, I'm <selector:@s>!
25+
```
26+
27+
```mm
28+
<red> This: Is: <light_purple>Epic!
29+
```
30+
31+
```mm
32+
<hover:show_text:'<red>Hover with a<newline><green>line break'>Text with<newline>line break</hover>
33+
```
34+
35+
```mm
36+
<nbt:block|entity|storage:id:path[:_separator_][:interpret]>
37+
```

0 commit comments

Comments
 (0)