Skip to content

Commit 499cc77

Browse files
committed
feat: update notiondown, use shiki
1 parent c8eea7a commit 499cc77

File tree

5 files changed

+27
-195
lines changed

5 files changed

+27
-195
lines changed

package-lock.json

Lines changed: 6 additions & 187 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@
3333
"ezog": "^0.4.0",
3434
"katex": "^0.16.25",
3535
"mermaid": "^11.12.1",
36-
"notiondown": "^0.2.2",
37-
"prismjs": "^1.30.0",
36+
"notiondown": "^0.2.4",
3837
"sharp": "^0.34.4",
3938
"tailwindcss": "^4.1.16"
4039
},
4140
"devDependencies": {
4241
"@types/katex": "^0.16.7",
4342
"@types/node": "^24.9.1",
44-
"@types/prismjs": "^1.26.5",
4543
"eslint": "^9.38.0",
4644
"eslint-config-reearth": "^0.3.8",
4745
"eslint-plugin-astro": "^1.4.0",

src/config-default.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Client, Options } from "notiondown";
1+
import type { Options } from "notiondown";
22

33
export type Config = {
44
title?: string;
@@ -81,6 +81,7 @@ const config: Config = {
8181
titleFontFamily: "Londrina Solid, sans-serif",
8282
},
8383
notiondown: {
84+
renderHtml: true,
8485
filter: {
8586
published: {
8687
enabled: true,
@@ -91,6 +92,9 @@ const config: Config = {
9192
operator: "on_or_before",
9293
value: "now"
9394
}
95+
},
96+
md2html: {
97+
shikiTheme: "github-light",
9498
}
9599
}
96100
};

src/integrations/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@ export default (): AstroIntegration => ({
1717
const publicAssetDir = path.join("public", ASSET_DIR);
1818

1919
// Remove existing symlink or directory
20-
if (fs.existsSync(publicAssetDir)) {
21-
fs.rmSync(publicAssetDir, { recursive: true });
22-
console.log(`astrotion: removed existing ${publicAssetDir}`);
20+
try {
21+
const stats = fs.lstatSync(publicAssetDir);
22+
// If it's a symlink, use unlinkSync; otherwise use rmSync
23+
if (stats.isSymbolicLink()) {
24+
fs.unlinkSync(publicAssetDir);
25+
console.log(`astrotion: removed existing symlink ${publicAssetDir}`);
26+
} else {
27+
fs.rmSync(publicAssetDir, { recursive: true, force: true });
28+
console.log(`astrotion: removed existing directory ${publicAssetDir}`);
29+
}
30+
} catch (error: any) {
31+
// ENOENT means the file doesn't exist, which is fine
32+
if (error.code !== "ENOENT") {
33+
console.error(`astrotion: error checking ${publicAssetDir}:`, error);
34+
}
2335
}
2436

2537
// Create symlink

src/layouts/Layout.astro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
import { GoogleAnalytics } from "astro-analytics";
33
import { GoogleFontsOptimizer } from "astro-google-fonts-optimizer";
4-
import "prismjs/themes/prism.min.css";
54
import "katex/dist/katex.min.css";
65
76
import Nav from "../components/Nav.astro";

0 commit comments

Comments
 (0)