Skip to content

Commit 7ba6b80

Browse files
committed
移出 rehype-callouts 插件,修改 aside组件样式
1 parent e054895 commit 7ba6b80

File tree

6 files changed

+228
-115
lines changed

6 files changed

+228
-115
lines changed

astro.config.mjs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ import expressiveCode from 'astro-expressive-code';
77
import icon from 'astro-icon';
88
import { defineConfig } from 'astro/config';
99
import fontCarrier from 'font-carrier';
10-
1110
// Others
1211
// import { visualizer } from 'rollup-plugin-visualizer'
13-
import rehypeCallouts from 'rehype-callouts';
14-
import rehypeKatex from 'rehype-katex';
15-
import remarkBreaks from 'remark-breaks';
12+
import rehypeKatex from 'rehype-katex'
13+
import remarkBreaks from 'remark-breaks'
1614
import remarkMath from 'remark-math';
1715

1816
import AstroPureIntegration from './packages/pure/index.ts';
@@ -23,10 +21,30 @@ import { remarkAiNotice } from './src/plugins/remark-ai-notice.mjs';
2321
import { remarkMermaid } from './src/plugins/remark-mermaid';
2422
import config from './src/site.config.ts';
2523

24+
2625
const createFontSubsetIntegration = () => {
2726
return {
2827
name: 'font-subset-integration',
2928
hooks: {
29+
'astro:server:start': () => {
30+
const projectRoot = process.cwd();
31+
const fontPath = path.join(projectRoot, 'src', 'assets', 'fonts', 'crjk03w03.ttf');
32+
const outputDir = path.join(projectRoot, 'public', 'fonts');
33+
const outputPath = path.join(outputDir, 'crjk-subset.ttf');
34+
35+
// To avoid slow startup, only copy the .ttf file in dev mode if it doesn't exist.
36+
// The browser will show 404s for woff/woff2 but will fall back to the ttf.
37+
if (fs.existsSync(outputPath)) {
38+
return;
39+
}
40+
41+
if (!fs.existsSync(outputDir)) {
42+
fs.mkdirSync(outputDir, { recursive: true });
43+
}
44+
45+
fs.copyFileSync(fontPath, outputPath);
46+
console.log('Development font .ttf copied to public/fonts!');
47+
},
3048
'astro:build:done': async ({ dir }) => {
3149
const projectRoot = process.cwd();
3250
const contentDir = path.join(projectRoot, 'src', 'content');
@@ -187,14 +205,6 @@ export default defineConfig({
187205
content: { type: 'text', value: '#' }
188206
}
189207
],
190-
[
191-
rehypeCallouts,
192-
{
193-
props: {
194-
containerProps: { class: ['callout', 'not-prose'] }
195-
}
196-
}
197-
]
198208
]
199209
},
200210
experimental: {

0 commit comments

Comments
 (0)