summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/spicy-icons-live.md14
-rw-r--r--packages/astro/components/shiki-themes.js6
-rw-r--r--packages/astro/scripts/shiki-gen-themes.mjs13
-rw-r--r--packages/integrations/markdoc/src/extensions/shiki.ts21
-rw-r--r--packages/integrations/mdx/src/remark-shiki.ts20
-rw-r--r--packages/markdown/remark/src/remark-shiki.ts20
6 files changed, 14 insertions, 80 deletions
diff --git a/.changeset/spicy-icons-live.md b/.changeset/spicy-icons-live.md
new file mode 100644
index 000000000..acde64e15
--- /dev/null
+++ b/.changeset/spicy-icons-live.md
@@ -0,0 +1,14 @@
+---
+'@astrojs/markdoc': minor
+'@astrojs/mdx': minor
+'@astrojs/markdown-remark': major
+'astro': major
+---
+
+Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:
+
+- `material-darker` -> `material-theme-darker`
+- `material-default` -> `material-theme`
+- `material-lighter` -> `material-theme-lighter`
+- `material-ocean` -> `material-theme-ocean`
+- `material-palenight` -> `material-theme-palenight`
diff --git a/packages/astro/components/shiki-themes.js b/packages/astro/components/shiki-themes.js
index 7f07d2417..8f6c4fccd 100644
--- a/packages/astro/components/shiki-themes.js
+++ b/packages/astro/components/shiki-themes.js
@@ -34,10 +34,4 @@ export const themes = {
'solarized-light': () => import('shiki/themes/solarized-light.json').then(mod => mod.default),
'vitesse-dark': () => import('shiki/themes/vitesse-dark.json').then(mod => mod.default),
'vitesse-light': () => import('shiki/themes/vitesse-light.json').then(mod => mod.default),
- // old theme names for compat
- 'material-darker': () => import('shiki/themes/material-theme-darker').then(mod => mod.default),
- 'material-default': () => import('shiki/themes/material-theme').then(mod => mod.default),
- 'material-lighter': () => import('shiki/themes/material-theme-lighter').then(mod => mod.default),
- 'material-ocean': () => import('shiki/themes/material-theme-ocean').then(mod => mod.default),
- 'material-palenight': () => import('shiki/themes/material-theme-palenight').then(mod => mod.default),
};
diff --git a/packages/astro/scripts/shiki-gen-themes.mjs b/packages/astro/scripts/shiki-gen-themes.mjs
index f6d30865d..30ff2f461 100644
--- a/packages/astro/scripts/shiki-gen-themes.mjs
+++ b/packages/astro/scripts/shiki-gen-themes.mjs
@@ -8,15 +8,6 @@ const themeImports = dir.map((f) => {
return [f.slice(0, f.indexOf('.json')), toThemeImport(f)];
});
-// Map of old theme names to new names to preserve compatibility when we upgrade shiki
-const compatThemes = {
- 'material-darker': 'material-theme-darker',
- 'material-default': 'material-theme',
- 'material-lighter': 'material-theme-lighter',
- 'material-ocean': 'material-theme-ocean',
- 'material-palenight': 'material-theme-palenight',
-};
-
let code = `\
/**
* This file is prebuilt from packages/astro/scripts/shiki-gen-themes.mjs
@@ -29,10 +20,6 @@ export const themes = {`;
for (const [key, imp] of themeImports) {
code += `\n\t'${key}': () => ${imp},`;
}
-code += `\n\t// old theme names for compat`;
-for (const oldName in compatThemes) {
- code += `\n\t'${oldName}': () => ${toThemeImport(compatThemes[oldName])},`;
-}
code += '\n};';
// eslint-disable-next-line no-console
diff --git a/packages/integrations/markdoc/src/extensions/shiki.ts b/packages/integrations/markdoc/src/extensions/shiki.ts
index a553a6bae..df3e79cf7 100644
--- a/packages/integrations/markdoc/src/extensions/shiki.ts
+++ b/packages/integrations/markdoc/src/extensions/shiki.ts
@@ -5,25 +5,6 @@ import type * as shikiTypes from 'shiki';
import { getHighlighter } from 'shiki';
import type { AstroMarkdocConfig } from '../config.js';
-// Map of old theme names to new names to preserve compatibility when we upgrade shiki
-const compatThemes: Record<string, string> = {
- 'material-darker': 'material-theme-darker',
- 'material-default': 'material-theme',
- 'material-lighter': 'material-theme-lighter',
- 'material-ocean': 'material-theme-ocean',
- 'material-palenight': 'material-theme-palenight',
-};
-
-const normalizeTheme = (theme: string | shikiTypes.IShikiTheme) => {
- if (typeof theme === 'string') {
- return compatThemes[theme] || theme;
- } else if (compatThemes[theme.name]) {
- return { ...theme, name: compatThemes[theme.name] };
- } else {
- return theme;
- }
-};
-
const ASTRO_COLOR_REPLACEMENTS = {
'#000001': 'var(--astro-code-color-text)',
'#000002': 'var(--astro-code-color-background)',
@@ -53,8 +34,6 @@ export default async function shiki({
theme = 'github-dark',
wrap = false,
}: ShikiConfig = {}): Promise<AstroMarkdocConfig> {
- theme = normalizeTheme(theme);
-
const cacheID: string = typeof theme === 'string' ? theme : theme.name;
if (!highlighterCache.has(cacheID)) {
highlighterCache.set(
diff --git a/packages/integrations/mdx/src/remark-shiki.ts b/packages/integrations/mdx/src/remark-shiki.ts
index 83625051e..a241aaa4e 100644
--- a/packages/integrations/mdx/src/remark-shiki.ts
+++ b/packages/integrations/mdx/src/remark-shiki.ts
@@ -10,27 +10,7 @@ import { visit } from 'unist-util-visit';
*/
const highlighterCacheAsync = new Map<string, Promise<shiki.Highlighter>>();
-// Map of old theme names to new names to preserve compatibility when we upgrade shiki
-const compatThemes: Record<string, string> = {
- 'material-darker': 'material-theme-darker',
- 'material-default': 'material-theme',
- 'material-lighter': 'material-theme-lighter',
- 'material-ocean': 'material-theme-ocean',
- 'material-palenight': 'material-theme-palenight',
-};
-
-const normalizeTheme = (theme: string | shiki.IShikiTheme) => {
- if (typeof theme === 'string') {
- return compatThemes[theme] || theme;
- } else if (compatThemes[theme.name]) {
- return { ...theme, name: compatThemes[theme.name] };
- } else {
- return theme;
- }
-};
-
const remarkShiki = async ({ langs = [], theme = 'github-dark', wrap = false }: ShikiConfig) => {
- theme = normalizeTheme(theme);
const cacheID: string = typeof theme === 'string' ? theme : theme.name;
let highlighterAsync = highlighterCacheAsync.get(cacheID);
if (!highlighterAsync) {
diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts
index 28e362e34..77cbf16c6 100644
--- a/packages/markdown/remark/src/remark-shiki.ts
+++ b/packages/markdown/remark/src/remark-shiki.ts
@@ -10,30 +10,10 @@ import type { ShikiConfig } from './types.js';
*/
const highlighterCacheAsync = new Map<string, Promise<shiki.Highlighter>>();
-// Map of old theme names to new names to preserve compatibility when we upgrade shiki
-const compatThemes: Record<string, string> = {
- 'material-darker': 'material-theme-darker',
- 'material-default': 'material-theme',
- 'material-lighter': 'material-theme-lighter',
- 'material-ocean': 'material-theme-ocean',
- 'material-palenight': 'material-theme-palenight',
-};
-
-const normalizeTheme = (theme: string | shiki.IShikiTheme) => {
- if (typeof theme === 'string') {
- return compatThemes[theme] || theme;
- } else if (compatThemes[theme.name]) {
- return { ...theme, name: compatThemes[theme.name] };
- } else {
- return theme;
- }
-};
-
const remarkShiki = async (
{ langs = [], theme = 'github-dark', wrap = false }: ShikiConfig,
scopedClassName?: string | null
) => {
- theme = normalizeTheme(theme);
const cacheID: string = typeof theme === 'string' ? theme : theme.name;
let highlighterAsync = highlighterCacheAsync.get(cacheID);
if (!highlighterAsync) {