Skip to content

Commit

Permalink
[Docs Site] Add default title to PowerShell codeblocks (#16975)
Browse files Browse the repository at this point in the history
  • Loading branch information
KianNH authored Sep 20, 2024
1 parent f75cc76 commit 598fbaf
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion ec.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,31 @@ function outputCodeblocks() {
});
}

function defaultLanguageTitles() {
return definePlugin({
name: "Adds language-specific default titles.",
hooks: {
preprocessLanguage: async (context) => {
switch (context.codeBlock.language) {
case "powershell": {
context.codeBlock.props.title ??= "PowerShell";
break;
}
default: {
return;
}
}
},
},
});
}

export default {
plugins: [workersPlaygroundButton(), outputCodeblocks()],
plugins: [
workersPlaygroundButton(),
outputCodeblocks(),
defaultLanguageTitles(),
],
themes: [darkTheme, lightTheme],
styleOverrides: {
textMarkers: {
Expand Down

0 comments on commit 598fbaf

Please sign in to comment.