Skip to content

Apply theme change only for ansi highlights #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,29 @@ export default defineUserConfig({
},
}),
shikiPlugin({
theme: 'dark-plus',
themes: {
dark: 'dark-plus',
onedarkpro: 'one-dark-pro', // pre-load one-dark-pro for ansi code blocks
},
lineNumbers: 10,
transformers: [
// use one-dark-pro theme for ansi code blocks
{
preprocess(code, options) {
if (options.lang == 'ansi') {
this.options.defaultColor = 'onedarkpro';
// this doesn't work at the top-level for some reason
this.options.colorReplacements = {
// make one-dark-pro background color the same as dark-plus
'#282c34': '#1e1e1e',
// HACK: change color of comments, since nu-highlight can't highlight them
'#abb2bf': '#80858f',
};
}
return code;
},
},
],
langs: [
'csv',
'nushell',
Expand Down
Loading