Skip to content

Commit 9ae2899

Browse files
edmundmillerclaude
andcommitted
feat: implement Expressive Code with line numbers and improved styling
- Create separate ec.config.mjs for Expressive Code plugin configuration - Install @expressive-code/plugin-line-numbers plugin - Enable line numbers by default with showLineNumbers: true - Set optimal font size (1.5rem/24px) for better code readability - Simplify astro.config.mjs to use basic expressiveCode() integration - Maintain all existing styling and text marker functionality - Fix MDX Code component compatibility with plugin-based configuration - Support external file imports with ?raw suffix for clean separation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f2c897a commit 9ae2899

File tree

7 files changed

+808
-113
lines changed

7 files changed

+808
-113
lines changed

astro.config.mjs

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import remarkDescription from "astro-remark-description";
44
import remarkDirective from "remark-directive";
55
import sitemap from "@astrojs/sitemap";
66
import expressiveCode from "astro-expressive-code";
7+
import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers'
8+
import mdx from "@astrojs/mdx";
79
import react from "@astrojs/react";
810
import tailwind from "@astrojs/tailwind";
911

@@ -46,71 +48,8 @@ export default defineConfig({
4648
],
4749
},
4850
integrations: [
49-
expressiveCode({
50-
// Use light theme for consistency with site design
51-
themes: ["github-light"],
52-
// Enable advanced features
53-
plugins: ["text-markers", "frames"],
54-
// Comprehensive styling to match site's clean, minimal design
55-
styleOverrides: {
56-
// Core background and text styling - pure white like site
57-
codeBackground: "#ffffff",
58-
codeForeground: "#24292f", // GitHub light theme text color
59-
60-
// Typography - match site's exact monospace stack
61-
codeFontFamily: "Menlo, Monaco, Consolas, 'Courier New', monospace",
62-
codeFontSize: "0.875rem", // 14px - readable code size
63-
codeLineHeight: "1.5",
64-
65-
// Borders - subtle gray matching site's container styling
66-
borderColor: "#e5e7eb", // rgb(229, 231, 235) - light gray
67-
borderWidth: "1px",
68-
borderRadius: "0.375rem", // Tailwind rounded-md
69-
70-
// Text markers - use site's green color scheme for highlighting
71-
textMarkers: {
72-
// Use the site's actual light green color for highlighting
73-
markBackground: "var(--nextflow-light-green)", // Direct use of site color
74-
markBorderColor: "transparent", // Clean, no borders
75-
76-
// Make highlighting more visible but still clean
77-
backgroundOpacity: "0.4", // More visible highlighting
78-
borderOpacity: "0", // No border opacity
79-
},
80-
81-
// Frames - clean, minimal styling
82-
frames: {
83-
// Remove all shadows and heavy styling
84-
shadowColor: "transparent",
85-
frameBoxShadowCssValue: "none",
86-
87-
// Clean frame styling matching site containers
88-
editorBackground: "#ffffff",
89-
editorActiveTabBackground: "#f9fafb", // Very light gray for active tab
90-
editorActiveTabBorderColor: "#e5e7eb", // Match border color
91-
editorTabBarBackground: "#ffffff",
92-
editorTabBarBorderColor: "#e5e7eb",
93-
94-
// Terminal-style frame styling
95-
terminalBackground: "#ffffff",
96-
terminalTitlebarBackground: "#f9fafb",
97-
terminalTitlebarForeground: "#6b7280", // Subtle gray text
98-
terminalTitlebarBorderColor: "#e5e7eb",
99-
},
100-
101-
// Focus and selection states
102-
focusBorder: "var(--nextflow-green)", // Use site's green for focus
103-
codeSelectionBackground: "var(--nextflow-light-green)", // Use site's light green
104-
105-
// Scrollbar styling
106-
scrollbarThumbColor: "#d1d5db", // Light gray
107-
scrollbarThumbHoverColor: "#9ca3af", // Slightly darker on hover
108-
109-
// Ensure clean, minimal appearance throughout
110-
uiSelectionBackground: "var(--nextflow-light-green)",
111-
uiSelectionForeground: "#1f2937", // Dark text for contrast
112-
},
113-
}),
51+
expressiveCode(),
52+
mdx(),
11453
react(),
11554
tailwind(),
11655
sitemap({

ec.config.mjs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { defineEcConfig } from "astro-expressive-code";
2+
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
3+
4+
export default defineEcConfig({
5+
// Use light theme for consistency with site design
6+
themes: ["github-light"],
7+
8+
// Enable advanced features
9+
plugins: [pluginLineNumbers()],
10+
11+
// Disable Expressive Code's built-in copy button and enable line numbers
12+
defaultProps: {
13+
showCopyToClipboardButton: false,
14+
showLineNumbers: true,
15+
},
16+
17+
// Comprehensive styling to match site's clean, minimal design
18+
styleOverrides: {
19+
// Core background and text styling - pure white like site
20+
codeBackground: "#ffffff",
21+
codeForeground: "#24292f", // GitHub light theme text color
22+
23+
// Typography - match site's exact monospace stack
24+
codeFontFamily: "Menlo, Monaco, Consolas, 'Courier New', monospace",
25+
codeFontSize: "1.5rem", // 24px - much larger, very readable code size
26+
codeLineHeight: "1.5",
27+
28+
// Borders - subtle gray matching site's container styling
29+
borderColor: "#e5e7eb", // rgb(229, 231, 235) - light gray
30+
borderWidth: "1px",
31+
borderRadius: "0.375rem", // Tailwind rounded-md
32+
33+
// Text markers - use site's green color scheme for highlighting
34+
textMarkers: {
35+
// Use the site's actual light green color for highlighting
36+
markBackground: "var(--nextflow-light-green)", // Direct use of site color
37+
markBorderColor: "transparent", // Clean, no borders
38+
39+
// Make highlighting more visible but still clean
40+
backgroundOpacity: "0.4", // More visible highlighting
41+
borderOpacity: "0", // No border opacity
42+
},
43+
44+
// Frames - clean, minimal styling
45+
frames: {
46+
// Remove all shadows and heavy styling
47+
shadowColor: "transparent",
48+
frameBoxShadowCssValue: "none",
49+
50+
// Clean frame styling matching site containers
51+
editorBackground: "#ffffff",
52+
editorActiveTabBackground: "#f9fafb", // Very light gray for active tab
53+
editorActiveTabBorderColor: "#e5e7eb", // Match border color
54+
editorTabBarBackground: "#ffffff",
55+
editorTabBarBorderColor: "#e5e7eb",
56+
57+
// Terminal-style frame styling
58+
terminalBackground: "#ffffff",
59+
terminalTitlebarBackground: "#f9fafb",
60+
terminalTitlebarForeground: "#6b7280", // Subtle gray text
61+
terminalTitlebarBorderColor: "#e5e7eb",
62+
},
63+
64+
// Focus and selection states
65+
focusBorder: "var(--nextflow-green)", // Use site's green for focus
66+
codeSelectionBackground: "var(--nextflow-light-green)", // Use site's light green
67+
68+
// Scrollbar styling
69+
scrollbarThumbColor: "#d1d5db", // Light gray
70+
scrollbarThumbHoverColor: "#9ca3af", // Slightly darker on hover
71+
72+
// Ensure clean, minimal appearance throughout
73+
uiSelectionBackground: "var(--nextflow-light-green)",
74+
uiSelectionForeground: "#1f2937", // Dark text for contrast
75+
},
76+
});

0 commit comments

Comments
 (0)