Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchen committed Jun 27, 2024
1 parent ef6a940 commit 58eb55c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
import { MermaidConfig } from 'mermaid';
import { defineConfig } from 'vitepress';
import { withMermaid } from 'vitepress-plugin-mermaid';
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
import { DocumentName, documentService } from '../services/DocumentService';
import { sidebarService } from '../services/SidebarService';
import { themeService } from '../services/ThemeService';
Expand All @@ -17,8 +17,8 @@ const vitepressConfig = defineConfig({
markdown: {
lineNumbers: true,
theme: {
light: await themeService.getTheme('Eva-Light'),
dark: await themeService.getTheme('Eva-Dark'),
light: await themeService.getTheme('Eva Light'),
dark: await themeService.getTheme('Eva Dark'),
},
codeTransformers: [transformerTwoslash()],
},
Expand Down
8 changes: 5 additions & 3 deletions docs/services/ThemeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export type RemoteThemeInfo = {
};

const themeInfos = {
'Eva-Light': { repo: 'fisheva/Eva-Theme', path: 'themes/Eva-Light.json', branch: 'master' },
'Eva-Dark': { repo: 'fisheva/Eva-Theme', path: 'themes/Eva-Dark.json', branch: 'master' },
'Eva Light': { repo: 'fisheva/Eva-Theme', path: 'themes/Eva-Light.json', branch: 'master' },
'Eva Dark': { repo: 'fisheva/Eva-Theme', path: 'themes/Eva-Dark.json', branch: 'master' },
} satisfies Record<string, RemoteThemeInfo>;
export type ThemeName = keyof typeof themeInfos;
class ThemeService implements IThemeService {
Expand All @@ -42,7 +42,9 @@ class ThemeService implements IThemeService {
const url = (await getRepoFileInfo(info.repo, info.path)).download_url!;
try {
const response = await axios.get<string>(url, { responseType: 'text' });
return (await import('jsonc-parser')).parse(response.data) as TextmateTheme;
const theme = (await import('jsonc-parser')).parse(response.data) as TextmateTheme;
console.log(theme.name);
return theme;
} catch (error) {
console.error('Error fetching JSON data:', error);
throw error;
Expand Down

0 comments on commit 58eb55c

Please sign in to comment.