thibaud frere commited on
Commit
f9074bc
Β·
1 Parent(s): 2dbf974

update doc

Browse files
app/.astro/astro/content.d.ts CHANGED
@@ -1,231 +0,0 @@
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
- "introduction.mdx": {
184
- id: "introduction.mdx";
185
- slug: "introduction";
186
- body: string;
187
- collection: "chapters";
188
- data: any
189
- } & { render(): Render[".mdx"] };
190
- "markdown.mdx": {
191
- id: "markdown.mdx";
192
- slug: "markdown";
193
- body: string;
194
- collection: "chapters";
195
- data: any
196
- } & { render(): Render[".mdx"] };
197
- "writing-your-content.mdx": {
198
- id: "writing-your-content.mdx";
199
- slug: "writing-your-content";
200
- body: string;
201
- collection: "chapters";
202
- data: any
203
- } & { render(): Render[".mdx"] };
204
- };
205
- "embeds": {
206
- "vibe-code-d3-embeds-directives.md": {
207
- id: "vibe-code-d3-embeds-directives.md";
208
- slug: "vibe-code-d3-embeds-directives";
209
- body: string;
210
- collection: "embeds";
211
- data: any
212
- } & { render(): Render[".md"] };
213
- };
214
-
215
- };
216
-
217
- type DataEntryMap = {
218
- "assets": {
219
- "data/mnist-variant-model": {
220
- id: "data/mnist-variant-model";
221
- collection: "assets";
222
- data: any
223
- };
224
- };
225
-
226
- };
227
-
228
- type AnyEntryMap = ContentEntryMap & DataEntryMap;
229
-
230
- export type ContentConfig = never;
231
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/package.json CHANGED
Binary files a/app/package.json and b/app/package.json differ
 
app/scripts/export-pdf.mjs CHANGED
@@ -168,8 +168,19 @@ async function main() {
168
  // filename can be provided, else computed from DOM (button) or page title later
169
  let outFileBase = (args.filename && String(args.filename).replace(/\.pdf$/i, '')) || 'article';
170
 
171
- console.log('> Building Astro site…');
172
- await run('npm', ['run', 'build']);
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  console.log('> Starting Astro preview…');
175
  // Start preview in its own process group so we can terminate all children reliably
@@ -413,7 +424,7 @@ async function main() {
413
  /* Banner centering & visibility */
414
  .hero .points { mix-blend-mode: normal !important; }
415
  .d3-galaxy { width: 100% !important; height: 300px; max-width: 980px !important; margin-left: auto !important; margin-right: auto !important; }
416
- .d3-galaxy svg { background: var(--surface-bg); width: 100% !important; height: auto !important; }
417
  ` });
418
  } catch {}
419
  await page.pdf({
 
168
  // filename can be provided, else computed from DOM (button) or page title later
169
  let outFileBase = (args.filename && String(args.filename).replace(/\.pdf$/i, '')) || 'article';
170
 
171
+ // Build only if dist/ does not exist
172
+ const distDir = resolve(cwd, 'dist');
173
+ let hasDist = false;
174
+ try {
175
+ const st = await fs.stat(distDir);
176
+ hasDist = st && st.isDirectory();
177
+ } catch {}
178
+ if (!hasDist) {
179
+ console.log('> Building Astro site…');
180
+ await run('npm', ['run', 'build']);
181
+ } else {
182
+ console.log('> Skipping build (dist/ exists)…');
183
+ }
184
 
185
  console.log('> Starting Astro preview…');
186
  // Start preview in its own process group so we can terminate all children reliably
 
424
  /* Banner centering & visibility */
425
  .hero .points { mix-blend-mode: normal !important; }
426
  .d3-galaxy { width: 100% !important; height: 300px; max-width: 980px !important; margin-left: auto !important; margin-right: auto !important; }
427
+ .d3-galaxy svg { width: 100% !important; height: auto !important; }
428
  ` });
429
  } catch {}
430
  await page.pdf({
app/src/content/chapters/components.mdx CHANGED
@@ -34,12 +34,14 @@ You have to import them in the **.mdx** file you want to use them in.
34
  | `downloadable` | No | Adds a download button to fetch the image file.
35
  | `loading="lazy"` | No | Lazy loads the image.
36
  | `caption` | No | Adds a caption and credit.
 
37
 
38
 
39
  <ResponsiveImage
40
  src={placeholder}
41
  zoomable
42
  downloadable
 
43
  layout="fixed"
44
  alt="A placeholder image alt text"
45
  caption={'A placeholder image description <span class="image-credit">From the <a target="_blank" href="https://commons.wikimedia.org/wiki/File:RCA_Indian_Head_Test_Pattern.svg">RCA Indian Head Test Pattern</a></span>'}
 
34
  | `downloadable` | No | Adds a download button to fetch the image file.
35
  | `loading="lazy"` | No | Lazy loads the image.
36
  | `caption` | No | Adds a caption and credit.
37
+ | `id` | No | Adds an `id` to the outer figure for deep-linking and cross-references.
38
 
39
 
40
  <ResponsiveImage
41
  src={placeholder}
42
  zoomable
43
  downloadable
44
+ id="placeholder-image"
45
  layout="fixed"
46
  alt="A placeholder image alt text"
47
  caption={'A placeholder image description <span class="image-credit">From the <a target="_blank" href="https://commons.wikimedia.org/wiki/File:RCA_Indian_Head_Test_Pattern.svg">RCA Indian Head Test Pattern</a></span>'}
app/src/content/chapters/markdown.mdx CHANGED
@@ -16,8 +16,8 @@ All the following **markdown features** are available **natively** in the `artic
16
  <div className="button-group">
17
  <a className="button" href="#math">Math</a>
18
  <a className="button" href="#code-blocks">Code</a>
19
- <a className="button" href="#citations-and-notes">Citations</a>
20
- <a className="button" href="#footnotes">Footnotes</a>
21
  <a className="button" href="#mermaid-diagrams">Mermaid</a>
22
  <a className="button" href="#separator">Separator</a>
23
  <a className="button" href="#table">Table</a>
@@ -26,7 +26,7 @@ All the following **markdown features** are available **natively** in the `artic
26
 
27
  ### Math
28
 
29
- KaTeX is used for math rendering. You can use inline notation `$...$` inline or block `$$...$$` notation. This is an inline math equation: $x^2 + y^2 = z^2$.
30
 
31
  $$
32
  \mathrm{Attention}(Q,K,V)=\mathrm{softmax}\!\left(\frac{QK^\top}{\sqrt{d_k}}\right) V
@@ -64,9 +64,13 @@ greet("Astro")
64
  ````
65
  </Accordion>
66
 
67
- ### Citations
68
 
69
- **Citations** use the `@` syntax (e.g., `[@vaswani2017attention]` or `@vaswani2017attention` in narrative form) and are **automatically** collected to render the **bibliography** at the end of the article. The citation keys come from `app/src/content/bibliography.bib`.
 
 
 
 
70
 
71
  1) In-text citation with brackets: [@vaswani2017attention].
72
 
@@ -88,9 +92,9 @@ greet("Astro")
88
  ```
89
  </Accordion>
90
 
91
- ### Footnotes
92
 
93
- **Footnotes** use an identifier like `[^f1]` and a definition anywhere in the document, e.g., `[^f1]: Your explanation`. They are **numbered** and **listed automatically** at the end of the article.
94
 
95
  1) Footnote attached to the sentence above[^f1].
96
 
@@ -120,9 +124,9 @@ greet("Astro")
120
  ```
121
  Result: `add(2, 3) === 5`.
122
 
123
- 4) Footnote that includes citations inside[^f5] and another footnote[^f1].
124
 
125
- [^f5]: Footnote containing citations [@vaswani2017attention] and [@kingma2015adam].
126
 
127
  <Accordion title="Code example">
128
  ```mdx
@@ -134,7 +138,7 @@ greet("Astro")
134
 
135
  3) Footnote with an inline code and an indented code block[^f4].
136
 
137
- 4) Footnote that includes citations inside[^f5].
138
 
139
  [^f1]: Footnote attached to the sentence above.
140
 
@@ -155,7 +159,34 @@ greet("Astro")
155
 
156
  Result: `add(2, 3) === 5`.
157
 
158
- [^f5]: Footnote containing citations [@vaswani2017attention] and [@kingma2015adam].
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  ```
160
  </Accordion>
161
 
 
16
  <div className="button-group">
17
  <a className="button" href="#math">Math</a>
18
  <a className="button" href="#code-blocks">Code</a>
19
+ <a className="button" href="#citation-and-notes">Citation</a>
20
+ <a className="button" href="#footnote">Footnote</a>
21
  <a className="button" href="#mermaid-diagrams">Mermaid</a>
22
  <a className="button" href="#separator">Separator</a>
23
  <a className="button" href="#table">Table</a>
 
26
 
27
  ### Math
28
 
29
+ KaTeX is used for math rendering. You can use **inline** notation `$...$` or **block** `$$...$$` notation. As an example, this is an **inline** math equation: $x^2 + y^2 = z^2$ and this is a **block**:
30
 
31
  $$
32
  \mathrm{Attention}(Q,K,V)=\mathrm{softmax}\!\left(\frac{QK^\top}{\sqrt{d_k}}\right) V
 
64
  ````
65
  </Accordion>
66
 
67
+ ### Citation
68
 
69
+ The **citation keys** come from `app/src/content/bibliography.bib`.
70
+
71
+ **Citation** use the `@` syntax (e.g., `[@vaswani2017attention]` or `@vaswani2017attention` in narrative form) and are **automatically** collected to render the **bibliography** at the end of the article.
72
+
73
+ <Note variant="info" emoji="πŸ’‘">Multiple citations to the same citation key are automatically merged into a single citation.</Note>
74
 
75
  1) In-text citation with brackets: [@vaswani2017attention].
76
 
 
92
  ```
93
  </Accordion>
94
 
95
+ ### Footnote
96
 
97
+ **Footnote** use an identifier like `[^f1]` and a definition anywhere in the document, e.g., `[^f1]: Your explanation`. They are **numbered** and **listed automatically** at the end of the article.
98
 
99
  1) Footnote attached to the sentence above[^f1].
100
 
 
124
  ```
125
  Result: `add(2, 3) === 5`.
126
 
127
+ 4) Footnote that includes citation inside[^f5] and another footnote[^f1].
128
 
129
+ [^f5]: Footnote containing citation [@vaswani2017attention] and [@kingma2015adam].
130
 
131
  <Accordion title="Code example">
132
  ```mdx
 
138
 
139
  3) Footnote with an inline code and an indented code block[^f4].
140
 
141
+ 4) Footnote that includes citation inside[^f5].
142
 
143
  [^f1]: Footnote attached to the sentence above.
144
 
 
159
 
160
  Result: `add(2, 3) === 5`.
161
 
162
+ [^f5]: Footnote containing citation [@vaswani2017attention] and [@kingma2015adam].
163
+ ```
164
+ </Accordion>
165
+
166
+
167
+ ### Reference
168
+
169
+ In research articles, you may have to make references to anything. They are basically html anchors. They can be used internally in the article or externally in other articles.
170
+
171
+ 1. **Title**<br/>
172
+ Each title is automatically generated with a slugged version from the citation key. ( slugged title from the citation key )
173
+ like for example, the id `#mermaid-diagrams` is generated from the `Mermaid diagrams` title.
174
+ <br/><br/>**Example** [Mermaid diagrams](#mermaid-diagram)
175
+
176
+ 2. **Image and chart**<br/>
177
+ You can make a link to an image or a chart by adding an ID on it.<br/>`<HtmlEmbed id="neural-network-mnist-like"/>` then you can link to it with a link like `<a href="#neural-network-mnist-like">Fig 1</a>`.
178
+ <br/><br/>**Example** [Chart 1](#neural-network-mnist-like) or [Fig 1](#placeholder-image)
179
+
180
+ <Accordion title="Code example">
181
+ ```mdx
182
+ #### Mermaid diagrams
183
+ [Mermaid diagrams](#mermaid-diagrams)
184
+
185
+ <HtmlEmbed id="neural-network-mnist-like"/>
186
+ [Chart 1](#neural-network-mnist-like)
187
+
188
+ <ResponsiveImage id="placeholder-image" src="..."/>
189
+ [Fig 1](#placeholder-image)
190
  ```
191
  </Accordion>
192
 
app/src/content/chapters/writing-your-content.mdx CHANGED
@@ -17,7 +17,7 @@ Once you have set up your project and started the development server, you can st
17
 
18
  Your **article** lives in **one and unique place**. The `content` folder.
19
 
20
- <HtmlEmbed frameless src="content-structure.html" />
21
 
22
  ### Article.mdx
23
 
@@ -130,7 +130,7 @@ Use the **color picker** below to see how the primary color affects the theme.
130
  #### Brand color
131
 
132
  <Sidenote>
133
- <HtmlEmbed frameless src="color-picker.html" />
134
  <Fragment slot="aside">
135
  You can use the color picker to select the right color.
136
 
@@ -143,7 +143,7 @@ Use the **color picker** below to see how the primary color affects the theme.
143
 
144
  Here is a suggestion of **color palettes** for your **data visualizations** that align with your **brand identity**. These palettes are generated from your `--primary-color`.
145
 
146
- <HtmlEmbed frameless src="palettes.html" />
147
  <br/>
148
  **Use color with care.**
149
  Color should rarely be the only channel of meaning.
 
17
 
18
  Your **article** lives in **one and unique place**. The `content` folder.
19
 
20
+ <HtmlEmbed frameless src="demo/content-structure.html" />
21
 
22
  ### Article.mdx
23
 
 
130
  #### Brand color
131
 
132
  <Sidenote>
133
+ <HtmlEmbed frameless src="demo/color-picker.html" />
134
  <Fragment slot="aside">
135
  You can use the color picker to select the right color.
136
 
 
143
 
144
  Here is a suggestion of **color palettes** for your **data visualizations** that align with your **brand identity**. These palettes are generated from your `--primary-color`.
145
 
146
+ <HtmlEmbed frameless src="demo/palettes.html" />
147
  <br/>
148
  **Use color with care.**
149
  Color should rarely be the only channel of meaning.
app/src/content/embeds/{color-picker.html β†’ demo/color-picker.html} RENAMED
File without changes
app/src/content/embeds/{content-structure.html β†’ demo/content-structure.html} RENAMED
File without changes
app/src/content/embeds/{palettes.html β†’ demo/palettes.html} RENAMED
File without changes