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 and elithrar committed Oct 15, 2024
1 parent 4284f0c commit 3a0d710
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 3a0d710

Please sign in to comment.