|
1 | 1 | --- |
2 | 2 | // Simplified homepage — prose-first, one code example, one terminal proof. |
| 3 | +import { Code } from "@astrojs/starlight/components"; |
| 4 | +
|
| 5 | +const serverExample = `const protocol = new Protocol("Calculator"); |
| 6 | +
|
| 7 | +protocol.unary("add", { |
| 8 | + params: { a: float, b: float }, |
| 9 | + result: { result: float }, |
| 10 | + handler: async ({ a, b }) => ({ result: a + b }), |
| 11 | +}); |
| 12 | +
|
| 13 | +new VgiRpcServer(protocol).run();`; |
3 | 14 | --- |
4 | 15 |
|
5 | 16 | <section class="home-content"> |
|
21 | 32 |
|
22 | 33 | <div class="code-section"> |
23 | 34 | <p class="code-label">A complete RPC server in 8 lines</p> |
24 | | - <div class="code-block"> |
25 | | - <pre><code><span class="kw">const</span> protocol = <span class="kw">new</span> <span class="cls">Protocol</span>(<span class="str">"Calculator"</span>); |
26 | | - |
27 | | -protocol.<span class="fn">unary</span>(<span class="str">"add"</span>, {'{'} |
28 | | - params: {'{'} a: <span class="typ">float</span>, b: <span class="typ">float</span> {'}'}, |
29 | | - result: {'{'} result: <span class="typ">float</span> {'}'}, |
30 | | - handler: <span class="kw">async</span> ({'{'} a, b {'}'}) => ({'{'} result: a + b {'}'}), |
31 | | -{'}'}); |
32 | | - |
33 | | -<span class="kw">new</span> <span class="cls">VgiRpcServer</span>(protocol).<span class="fn">run</span>();</code></pre> |
34 | | - </div> |
| 35 | + <Code code={serverExample} lang="ts" /> |
35 | 36 | </div> |
36 | 37 |
|
37 | 38 | <div class="terminal-section"> |
@@ -95,31 +96,11 @@ protocol.<span class="fn">unary</span>(<span class="str">"add"</span>, {'{'} |
95 | 96 | letter-spacing: 0.05em; |
96 | 97 | font-weight: 500; |
97 | 98 | } |
98 | | - .code-block { |
99 | | - border-radius: 0.75rem; |
100 | | - overflow: hidden; |
101 | | - border: 1px solid #2d5016; |
102 | | - background: #0d2818; |
103 | | - } |
104 | | - .code-block pre { |
| 99 | + /* The code example renders via Starlight's <Code> component, which uses |
| 100 | + the shared "farm-theme" Expressive Code config — no hand-rolled markup. */ |
| 101 | + .code-section :global(.expressive-code) { |
105 | 102 | margin: 0; |
106 | | - padding: 1.5rem; |
107 | | - overflow-x: auto; |
108 | | - font-size: 0.875rem; |
109 | | - line-height: 1.7; |
110 | 103 | } |
111 | | - .code-block code { |
112 | | - font-family: var(--__sl-font-mono); |
113 | | - background: none; |
114 | | - color: #e8f5e9; |
115 | | - } |
116 | | - |
117 | | - /* ── Syntax colors (query.farm "farm-theme") ── */ |
118 | | - .kw { color: #66bb6a; font-weight: 700; } |
119 | | - .cls { color: #fff59d; } |
120 | | - .fn { color: #ffeb3b; } |
121 | | - .str { color: #c5e1a5; } |
122 | | - .typ { color: #fff59d; } |
123 | 104 |
|
124 | 105 | /* ── Terminal proof ── */ |
125 | 106 | .terminal-section { |
@@ -153,11 +134,14 @@ protocol.<span class="fn">unary</span>(<span class="str">"add"</span>, {'{'} |
153 | 134 | padding: 1rem 1.25rem; |
154 | 135 | font-size: 0.8125rem; |
155 | 136 | line-height: 1.7; |
| 137 | + background: transparent; |
156 | 138 | } |
157 | | - .terminal code { |
| 139 | + /* Beat Starlight's `.sl-markdown-content pre code` color rule so the |
| 140 | + un-marked command text isn't inherited dark on the dark-green terminal. */ |
| 141 | + .terminal pre code { |
158 | 142 | font-family: var(--__sl-font-mono); |
159 | 143 | background: none; |
160 | | - color: #e8f5e9; |
| 144 | + color: #e8f5e9 !important; |
161 | 145 | } |
162 | 146 | .prompt { color: #66bb6a; font-weight: 700; } |
163 | 147 | .out { color: #c5e1a5; } |
|
0 commit comments