thibaud frere commited on
Commit
4ec15bc
·
1 Parent(s): 4f3bb9d

update hf user, overal layout, code output

Browse files
app/.astro/astro/content.d.ts CHANGED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ declare module 'astro:content' {
2
+ interface Render {
3
+ '.mdx': Promise<{
4
+ Content: import('astro').MarkdownInstance<{}>['Content'];
5
+ headings: import('astro').MarkdownHeading[];
6
+ remarkPluginFrontmatter: Record<string, any>;
7
+ components: import('astro').MDXInstance<{}>['components'];
8
+ }>;
9
+ }
10
+ }
11
+
12
+ declare module 'astro:content' {
13
+ interface RenderResult {
14
+ Content: import('astro/runtime/server/index.js').AstroComponentFactory;
15
+ headings: import('astro').MarkdownHeading[];
16
+ remarkPluginFrontmatter: Record<string, any>;
17
+ }
18
+ interface Render {
19
+ '.md': Promise<RenderResult>;
20
+ }
21
+
22
+ export interface RenderedContent {
23
+ html: string;
24
+ metadata?: {
25
+ imagePaths: Array<string>;
26
+ [key: string]: unknown;
27
+ };
28
+ }
29
+ }
30
+
31
+ declare module 'astro:content' {
32
+ type Flatten<T> = T extends { [K: string]: infer U } ? U : never;
33
+
34
+ export type CollectionKey = keyof AnyEntryMap;
35
+ export type CollectionEntry<C extends CollectionKey> = Flatten<AnyEntryMap[C]>;
36
+
37
+ export type ContentCollectionKey = keyof ContentEntryMap;
38
+ export type DataCollectionKey = keyof DataEntryMap;
39
+
40
+ type AllValuesOf<T> = T extends any ? T[keyof T] : never;
41
+ type ValidContentEntrySlug<C extends keyof ContentEntryMap> = AllValuesOf<
42
+ ContentEntryMap[C]
43
+ >['slug'];
44
+
45
+ /** @deprecated Use `getEntry` instead. */
46
+ export function getEntryBySlug<
47
+ C extends keyof ContentEntryMap,
48
+ E extends ValidContentEntrySlug<C> | (string & {}),
49
+ >(
50
+ collection: C,
51
+ // Note that this has to accept a regular string too, for SSR
52
+ entrySlug: E,
53
+ ): E extends ValidContentEntrySlug<C>
54
+ ? Promise<CollectionEntry<C>>
55
+ : Promise<CollectionEntry<C> | undefined>;
56
+
57
+ /** @deprecated Use `getEntry` instead. */
58
+ export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
59
+ collection: C,
60
+ entryId: E,
61
+ ): Promise<CollectionEntry<C>>;
62
+
63
+ export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
64
+ collection: C,
65
+ filter?: (entry: CollectionEntry<C>) => entry is E,
66
+ ): Promise<E[]>;
67
+ export function getCollection<C extends keyof AnyEntryMap>(
68
+ collection: C,
69
+ filter?: (entry: CollectionEntry<C>) => unknown,
70
+ ): Promise<CollectionEntry<C>[]>;
71
+
72
+ export function getEntry<
73
+ C extends keyof ContentEntryMap,
74
+ E extends ValidContentEntrySlug<C> | (string & {}),
75
+ >(entry: {
76
+ collection: C;
77
+ slug: E;
78
+ }): E extends ValidContentEntrySlug<C>
79
+ ? Promise<CollectionEntry<C>>
80
+ : Promise<CollectionEntry<C> | undefined>;
81
+ export function getEntry<
82
+ C extends keyof DataEntryMap,
83
+ E extends keyof DataEntryMap[C] | (string & {}),
84
+ >(entry: {
85
+ collection: C;
86
+ id: E;
87
+ }): E extends keyof DataEntryMap[C]
88
+ ? Promise<DataEntryMap[C][E]>
89
+ : Promise<CollectionEntry<C> | undefined>;
90
+ export function getEntry<
91
+ C extends keyof ContentEntryMap,
92
+ E extends ValidContentEntrySlug<C> | (string & {}),
93
+ >(
94
+ collection: C,
95
+ slug: E,
96
+ ): E extends ValidContentEntrySlug<C>
97
+ ? Promise<CollectionEntry<C>>
98
+ : Promise<CollectionEntry<C> | undefined>;
99
+ export function getEntry<
100
+ C extends keyof DataEntryMap,
101
+ E extends keyof DataEntryMap[C] | (string & {}),
102
+ >(
103
+ collection: C,
104
+ id: E,
105
+ ): E extends keyof DataEntryMap[C]
106
+ ? Promise<DataEntryMap[C][E]>
107
+ : Promise<CollectionEntry<C> | undefined>;
108
+
109
+ /** Resolve an array of entry references from the same collection */
110
+ export function getEntries<C extends keyof ContentEntryMap>(
111
+ entries: {
112
+ collection: C;
113
+ slug: ValidContentEntrySlug<C>;
114
+ }[],
115
+ ): Promise<CollectionEntry<C>[]>;
116
+ export function getEntries<C extends keyof DataEntryMap>(
117
+ entries: {
118
+ collection: C;
119
+ id: keyof DataEntryMap[C];
120
+ }[],
121
+ ): Promise<CollectionEntry<C>[]>;
122
+
123
+ export function render<C extends keyof AnyEntryMap>(
124
+ entry: AnyEntryMap[C][string],
125
+ ): Promise<RenderResult>;
126
+
127
+ export function reference<C extends keyof AnyEntryMap>(
128
+ collection: C,
129
+ ): import('astro/zod').ZodEffects<
130
+ import('astro/zod').ZodString,
131
+ C extends keyof ContentEntryMap
132
+ ? {
133
+ collection: C;
134
+ slug: ValidContentEntrySlug<C>;
135
+ }
136
+ : {
137
+ collection: C;
138
+ id: keyof DataEntryMap[C];
139
+ }
140
+ >;
141
+ // Allow generic `string` to avoid excessive type errors in the config
142
+ // if `dev` is not running to update as you edit.
143
+ // Invalid collection names will be caught at build time.
144
+ export function reference<C extends string>(
145
+ collection: C,
146
+ ): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
147
+
148
+ type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
149
+ type InferEntrySchema<C extends keyof AnyEntryMap> = import('astro/zod').infer<
150
+ ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
151
+ >;
152
+
153
+ type ContentEntryMap = {
154
+ "chapters": {
155
+ "best-pratices.mdx": {
156
+ id: "best-pratices.mdx";
157
+ slug: "best-pratices";
158
+ body: string;
159
+ collection: "chapters";
160
+ data: any
161
+ } & { render(): Render[".mdx"] };
162
+ "components.mdx": {
163
+ id: "components.mdx";
164
+ slug: "components";
165
+ body: string;
166
+ collection: "chapters";
167
+ data: any
168
+ } & { render(): Render[".mdx"] };
169
+ "debug-components.mdx": {
170
+ id: "debug-components.mdx";
171
+ slug: "debug-components";
172
+ body: string;
173
+ collection: "chapters";
174
+ data: any
175
+ } & { render(): Render[".mdx"] };
176
+ "getting-started.mdx": {
177
+ id: "getting-started.mdx";
178
+ slug: "getting-started";
179
+ body: string;
180
+ collection: "chapters";
181
+ data: any
182
+ } & { render(): Render[".mdx"] };
183
+ "greetings.mdx": {
184
+ id: "greetings.mdx";
185
+ slug: "greetings";
186
+ body: string;
187
+ collection: "chapters";
188
+ data: any
189
+ } & { render(): Render[".mdx"] };
190
+ "introduction.mdx": {
191
+ id: "introduction.mdx";
192
+ slug: "introduction";
193
+ body: string;
194
+ collection: "chapters";
195
+ data: any
196
+ } & { render(): Render[".mdx"] };
197
+ "markdown.mdx": {
198
+ id: "markdown.mdx";
199
+ slug: "markdown";
200
+ body: string;
201
+ collection: "chapters";
202
+ data: any
203
+ } & { render(): Render[".mdx"] };
204
+ "writing-your-content.mdx": {
205
+ id: "writing-your-content.mdx";
206
+ slug: "writing-your-content";
207
+ body: string;
208
+ collection: "chapters";
209
+ data: any
210
+ } & { render(): Render[".mdx"] };
211
+ };
212
+ "embeds": {
213
+ "vibe-code-d3-embeds-directives.md": {
214
+ id: "vibe-code-d3-embeds-directives.md";
215
+ slug: "vibe-code-d3-embeds-directives";
216
+ body: string;
217
+ collection: "embeds";
218
+ data: any
219
+ } & { render(): Render[".md"] };
220
+ };
221
+
222
+ };
223
+
224
+ type DataEntryMap = {
225
+ "assets": {
226
+ "data/mnist-variant-model": {
227
+ id: "data/mnist-variant-model";
228
+ collection: "assets";
229
+ data: any
230
+ };
231
+ };
232
+
233
+ };
234
+
235
+ type AnyEntryMap = ContentEntryMap & DataEntryMap;
236
+
237
+ export type ContentConfig = never;
238
+ }
app/src/components/Accordion.astro CHANGED
@@ -79,7 +79,7 @@ const wrapperClass = ["accordion", className].filter(Boolean).join(" ");
79
  margin: 0 0 var(--spacing-4);
80
  padding: 0;
81
  border: 1px solid var(--border-color);
82
- border-radius: 10px;
83
  background: var(--surface-bg);
84
  transition: box-shadow 180ms ease, border-color 180ms ease;
85
  }
@@ -141,16 +141,32 @@ const wrapperClass = ["accordion", className].filter(Boolean).join(" ");
141
  position: relative;
142
  }
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  .accordion__content {
145
  margin: 0;
146
  padding: 0;
147
  }
148
 
149
- /* Ensure the very last slotted element has no bottom spacing */
150
  .accordion .accordion__content > :global(*:last-child) {
151
- padding-bottom: 0 !important;
152
  margin-bottom: 0 !important;
153
  }
 
 
 
 
154
 
155
  /* Ensure the very first slotted element has no top spacing */
156
  .accordion .accordion__content > :global(*:first-child) {
@@ -167,23 +183,11 @@ const wrapperClass = ["accordion", className].filter(Boolean).join(" ");
167
  padding: 0;
168
  }
169
 
170
- /* Separator between header and content when open (edge-to-edge) */
171
- .accordion[open] .accordion__content-wrapper::before {
172
- content: "";
173
- position: absolute;
174
- left: 0;
175
- right: 0;
176
- top: 0px; /* space below header */
177
- height: 1px;
178
- background: var(--border-color);
179
- pointer-events: none;
180
- }
181
-
182
  /* Focus styles for accessibility */
183
  .accordion__summary:focus-visible {
184
  outline: 2px solid var(--primary-color);
185
  outline-offset: 3px;
186
- border-radius: 8px;
187
  }
188
 
189
 
 
79
  margin: 0 0 var(--spacing-4);
80
  padding: 0;
81
  border: 1px solid var(--border-color);
82
+ border-radius: var(--table-border-radius);
83
  background: var(--surface-bg);
84
  transition: box-shadow 180ms ease, border-color 180ms ease;
85
  }
 
141
  position: relative;
142
  }
143
 
144
+ /* Subtle top shadow overlay when open (visible above children) */
145
+ .accordion[open] .accordion__content-wrapper::before {
146
+ content: "";
147
+ position: absolute;
148
+ left: 0;
149
+ right: 0;
150
+ top: 0;
151
+ height: 6px;
152
+ background: linear-gradient(to bottom, rgba(0,0,0,0.025), rgba(0,0,0,0));
153
+ pointer-events: none;
154
+ z-index: 1;
155
+ }
156
+
157
  .accordion__content {
158
  margin: 0;
159
  padding: 0;
160
  }
161
 
162
+ /* Ensure the very last slotted element has no bottom margin */
163
  .accordion .accordion__content > :global(*:last-child) {
 
164
  margin-bottom: 0 !important;
165
  }
166
+ /* Remove bottom padding on last child, except for code-output blocks */
167
+ .accordion .accordion__content > :global(:not(.code-output):last-child) {
168
+ padding-bottom: 0 !important;
169
+ }
170
 
171
  /* Ensure the very first slotted element has no top spacing */
172
  .accordion .accordion__content > :global(*:first-child) {
 
183
  padding: 0;
184
  }
185
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  /* Focus styles for accessibility */
187
  .accordion__summary:focus-visible {
188
  outline: 2px solid var(--primary-color);
189
  outline-offset: 3px;
190
+ border-radius: var(--table-border-radius);
191
  }
192
 
193
 
app/src/components/HfUser.astro CHANGED
@@ -39,8 +39,6 @@ const imgSrc = avatarUrl ?? `https://huggingface.co/api/users/${encodeURICompone
39
  gap: 10px;
40
  padding: 10px 10px 10px 12px;
41
  border-radius: 12px;
42
- background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
43
- border: 1px solid rgba(255, 255, 255, 0.08);
44
  box-shadow: none;
45
  }
46
  .hf-user__left {
 
39
  gap: 10px;
40
  padding: 10px 10px 10px 12px;
41
  border-radius: 12px;
 
 
42
  box-shadow: none;
43
  }
44
  .hf-user__left {
app/src/content/chapters/markdown.mdx CHANGED
@@ -86,6 +86,15 @@ Or it can also be used at a standalone block.
86
  Hello i'm a standalone output block.
87
  :::
88
 
 
 
 
 
 
 
 
 
 
89
 
90
  <Accordion title="Code example">
91
  ````mdx
 
86
  Hello i'm a standalone output block.
87
  :::
88
 
89
+ <Accordion title="It also works in an accordion">
90
+ ```python
91
+ print("This script prints a very very long line to check overflow behavior.")
92
+ ```
93
+ ::::output
94
+ This script prints a very very long line to check overflow behavior.
95
+ ::::
96
+ </Accordion>
97
+
98
 
99
  <Accordion title="Code example">
100
  ````mdx
app/src/styles/_layout.css CHANGED
@@ -8,7 +8,7 @@
8
  padding: 0 var(--content-padding-x);
9
  margin-top: 40px;
10
  display: grid;
11
- grid-template-columns: 220px minmax(0, 680px) 260px;
12
  gap: 32px;
13
  align-items: start;
14
  }
@@ -70,15 +70,15 @@
70
 
71
  .wide {
72
  /* Target up to ~1100px while staying within viewport minus page gutters */
73
- width: min(1100px, 100vw - 32px);
74
- margin-left: calc(50% + var(--content-padding-x) * 2);
75
  transform: translateX(-50%);
76
  }
77
 
78
  .full-width {
79
  /* Span the full viewport width and center relative to viewport */
80
  width: 100vw;
81
- margin-left: calc(50% - 50vw + var(--content-padding-x) * 2);
82
  margin-right: calc(50% - 50vw);
83
  }
84
 
 
8
  padding: 0 var(--content-padding-x);
9
  margin-top: 40px;
10
  display: grid;
11
+ grid-template-columns: 260px minmax(0, 680px) 260px;
12
  gap: 32px;
13
  align-items: start;
14
  }
 
70
 
71
  .wide {
72
  /* Target up to ~1100px while staying within viewport minus page gutters */
73
+ width: min(1100px, 100vw - var(--content-padding-x) * 2);
74
+ margin-left: 50%;
75
  transform: translateX(-50%);
76
  }
77
 
78
  .full-width {
79
  /* Span the full viewport width and center relative to viewport */
80
  width: 100vw;
81
+ margin-left: calc(50% - 50vw);
82
  margin-right: calc(50% - 50vw);
83
  }
84
 
app/src/styles/components/_code.css CHANGED
@@ -39,7 +39,6 @@ section.content-grid pre {
39
  -webkit-overflow-scrolling: touch;
40
  padding: 0;
41
  margin-bottom: var(--block-spacing-y) !important;
42
- overflow: hidden!important;
43
  overflow-x: auto;
44
  }
45
 
@@ -150,6 +149,7 @@ section.content-grid pre code {
150
  /* Inside Accordions: remove padding and border on code containers */
151
  .accordion .astro-code { padding: 0; border: none; }
152
  .accordion .astro-code { margin-bottom: 0 !important; }
 
153
  .accordion pre { margin-bottom: 0 !important; }
154
  .accordion .code-card pre { margin: 0 !important; }
155
 
@@ -203,9 +203,13 @@ section.content-grid pre code {
203
  background: oklch(from var(--code-bg) calc(l - 0.005) c h);
204
  border: 1px solid var(--border-color);
205
  border-radius: 6px;
206
- padding: calc(var(--spacing-3) + 6px) var(--spacing-3) var(--spacing-3) var(--spacing-3);
207
  margin-top: 0;
208
  margin-bottom: var(--block-spacing-y);
 
 
 
 
 
209
  }
210
 
211
  /* If immediately following a code container, keep tight visual connection */
@@ -217,7 +221,6 @@ section.content-grid pre + .code-output {
217
  border-top-left-radius: 0;
218
  border-top-right-radius: 0;
219
  box-shadow: inset 0 8px 12px -12px rgba(0, 0, 0, 0.15);
220
-
221
  }
222
 
223
  /* Remove bottom margin on code when immediately followed by results */
 
39
  -webkit-overflow-scrolling: touch;
40
  padding: 0;
41
  margin-bottom: var(--block-spacing-y) !important;
 
42
  overflow-x: auto;
43
  }
44
 
 
149
  /* Inside Accordions: remove padding and border on code containers */
150
  .accordion .astro-code { padding: 0; border: none; }
151
  .accordion .astro-code { margin-bottom: 0 !important; }
152
+ .accordion .code-output { border: none; border-top: 1px solid var(--border-color)!important; }
153
  .accordion pre { margin-bottom: 0 !important; }
154
  .accordion .code-card pre { margin: 0 !important; }
155
 
 
203
  background: oklch(from var(--code-bg) calc(l - 0.005) c h);
204
  border: 1px solid var(--border-color);
205
  border-radius: 6px;
 
206
  margin-top: 0;
207
  margin-bottom: var(--block-spacing-y);
208
+ padding: 0 !important;
209
+ }
210
+
211
+ .code-output pre {
212
+ padding: calc(var(--spacing-3) + 6px) var(--spacing-3) var(--spacing-3) var(--spacing-3) !important;
213
  }
214
 
215
  /* If immediately following a code container, keep tight visual connection */
 
221
  border-top-left-radius: 0;
222
  border-top-right-radius: 0;
223
  box-shadow: inset 0 8px 12px -12px rgba(0, 0, 0, 0.15);
 
224
  }
225
 
226
  /* Remove bottom margin on code when immediately followed by results */
app/src/styles/global.css CHANGED
@@ -10,12 +10,15 @@
10
 
11
  .demo-wide,
12
  .demo-full-width {
13
- display: grid;
14
- place-items: center;
 
 
 
15
  min-height: 150px;
16
  color: var(--muted-color);
17
  font-size: 12px;
18
- border: 1px dashed var(--border-color);
19
  border-radius: 8px;
20
  background: var(--surface-bg);
21
  margin-bottom: var(--block-spacing-y);
 
10
 
11
  .demo-wide,
12
  .demo-full-width {
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ justify-content: center;
17
+ width: 100%;
18
  min-height: 150px;
19
  color: var(--muted-color);
20
  font-size: 12px;
21
+ border: 2px dashed var(--border-color);
22
  border-radius: 8px;
23
  background: var(--surface-bg);
24
  margin-bottom: var(--block-spacing-y);