Skip to content

Commit 598fbaf

Browse files
authored
[Docs Site] Add default title to PowerShell codeblocks (#16975)
1 parent f75cc76 commit 598fbaf

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

ec.config.mjs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,31 @@ function outputCodeblocks() {
122122
});
123123
}
124124

125+
function defaultLanguageTitles() {
126+
return definePlugin({
127+
name: "Adds language-specific default titles.",
128+
hooks: {
129+
preprocessLanguage: async (context) => {
130+
switch (context.codeBlock.language) {
131+
case "powershell": {
132+
context.codeBlock.props.title ??= "PowerShell";
133+
break;
134+
}
135+
default: {
136+
return;
137+
}
138+
}
139+
},
140+
},
141+
});
142+
}
143+
125144
export default {
126-
plugins: [workersPlaygroundButton(), outputCodeblocks()],
145+
plugins: [
146+
workersPlaygroundButton(),
147+
outputCodeblocks(),
148+
defaultLanguageTitles(),
149+
],
127150
themes: [darkTheme, lightTheme],
128151
styleOverrides: {
129152
textMarkers: {

0 commit comments

Comments
 (0)