Skip to content

Commit 1732a25

Browse files
committed
style: reformat code
1 parent 5390459 commit 1732a25

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed
Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { definePlugin, InlineStyleAnnotation, type ExpressiveCodePlugin } from "@astrojs/starlight/expressive-code";
1+
import {
2+
definePlugin,
3+
InlineStyleAnnotation,
4+
type ExpressiveCodePlugin,
5+
} from "@astrojs/starlight/expressive-code";
26

37
export function pluginCxxMark(): ExpressiveCodePlugin {
48
return definePlugin({
@@ -7,51 +11,55 @@ export function pluginCxxMark(): ExpressiveCodePlugin {
711
postprocessAnalyzedCode: (context) => {
812
context.codeBlock.getLines().forEach((line) => {
913
if (context.codeBlock.meta.includes("cxx-mark")) {
10-
const matches = [...line.text.matchAll(/\/\*\$(((?<syntax>s)|(?<exposition>expos)):[^\*]+|(?<optional>opt))\*\//g)].reverse()
14+
const matches = [
15+
...line.text.matchAll(
16+
/\/\*\$(((?<syntax>s)|(?<exposition>expos)):[^\*]+|(?<optional>opt))\*\//g
17+
),
18+
].reverse();
1119
matches.forEach((match) => {
12-
const begin = match.index
13-
const end = begin + match[0].length
20+
const begin = match.index;
21+
const end = begin + match[0].length;
1422
if (match.groups?.syntax != undefined) {
1523
line.addAnnotation(
1624
new InlineStyleAnnotation({
1725
inlineRange: {
1826
columnStart: begin,
19-
columnEnd: end
27+
columnEnd: end,
2028
},
2129
// color of syntax notation should be same with comments
22-
italic: true
30+
italic: true,
2331
})
24-
)
25-
line.editText(begin, end, match[0].slice(5, -2))
32+
);
33+
line.editText(begin, end, match[0].slice(5, -2));
2634
} else if (match.groups?.exposition != undefined) {
2735
line.addAnnotation(
2836
new InlineStyleAnnotation({
2937
inlineRange: {
3038
columnStart: begin,
31-
columnEnd: end
39+
columnEnd: end,
3240
},
3341
color: "var(--cppdoc-color-cxx-mark-exposition)",
34-
italic: true
42+
italic: true,
3543
})
36-
)
37-
line.editText(begin + 2, begin + 9, "")
44+
);
45+
line.editText(begin + 2, begin + 9, "");
3846
} else if (match.groups?.optional != undefined) {
39-
const new_str = "(optional)"
40-
line.editText(begin, end, new_str)
47+
const new_str = "(optional)";
48+
line.editText(begin, end, new_str);
4149
line.addAnnotation(
4250
new InlineStyleAnnotation({
4351
inlineRange: {
4452
columnStart: begin,
45-
columnEnd: begin + new_str.length
53+
columnEnd: begin + new_str.length,
4654
},
47-
color: "var(--cppdoc-color-cxx-mark-optional)"
55+
color: "var(--cppdoc-color-cxx-mark-optional)",
4856
})
49-
)
57+
);
5058
}
51-
})
59+
});
5260
}
53-
})
54-
}
55-
}
56-
})
57-
}
61+
});
62+
},
63+
},
64+
});
65+
}

0 commit comments

Comments
 (0)