Spaces:
Running
Running
thibaud frere
commited on
Commit
·
f1ef9f0
1
Parent(s):
b2ac38d
update
Browse files
app/src/content/article.mdx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
---
|
| 2 |
-
title: "From Idea to
|
| 3 |
"
|
| 4 |
-
subtitle: "
|
| 5 |
description: "A modern, MDX-first research article template with math, citations, and interactive figures."
|
| 6 |
authors:
|
| 7 |
- "John Doe"
|
|
@@ -107,7 +107,8 @@ Your article lives in two places:
|
|
| 107 |
- `app/src/content/` — where you can find the article.mdx, bibliography.bib and html fragments.
|
| 108 |
- `app/src/assets/` — images, audio, and other static assets. (handled by git lfs)
|
| 109 |
|
| 110 |
-
|
|
|
|
| 111 |
|
| 112 |
```mdx
|
| 113 |
{/* HEADER */}
|
|
@@ -168,7 +169,7 @@ $x^2 + y^2 = z^2$
|
|
| 168 |
**Block**
|
| 169 |
|
| 170 |
$$
|
| 171 |
-
|
| 172 |
$$
|
| 173 |
|
| 174 |
```mdx
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "From Idea to Interaction:\n A Modern Template for Scientific Writing
|
| 3 |
"
|
| 4 |
+
subtitle: "Markdown-first research article template with math, citations, and interactive figures."
|
| 5 |
description: "A modern, MDX-first research article template with math, citations, and interactive figures."
|
| 6 |
authors:
|
| 7 |
- "John Doe"
|
|
|
|
| 107 |
- `app/src/content/` — where you can find the article.mdx, bibliography.bib and html fragments.
|
| 108 |
- `app/src/assets/` — images, audio, and other static assets. (handled by git lfs)
|
| 109 |
|
| 110 |
+
This is MDX, its basically a markdown file with html and astro components.
|
| 111 |
+
The **initial skeleton** of an article looks like this.
|
| 112 |
|
| 113 |
```mdx
|
| 114 |
{/* HEADER */}
|
|
|
|
| 169 |
**Block**
|
| 170 |
|
| 171 |
$$
|
| 172 |
+
\mathrm{Attention}(Q,K,V)=\mathrm{softmax}\!\left(\frac{QK^\top}{\sqrt{d_k}}\right) V
|
| 173 |
$$
|
| 174 |
|
| 175 |
```mdx
|
app/src/content/fragments/palettes.html
CHANGED
|
@@ -77,13 +77,14 @@
|
|
| 77 |
loadScript('chroma-cdn-fallback', 'https://cdnjs.cloudflare.com/ajax/libs/chroma-js/2.4.2/chroma.min.js', next);
|
| 78 |
});
|
| 79 |
};
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
loadScript('ntc-cdn', 'https://unpkg.com/ntcjs@1.0.0/build/ntc.js', next, () => next());
|
| 83 |
-
};
|
| 84 |
-
ensureD3(() => ensureChroma(() => ensureNtc(cb)));
|
| 85 |
};
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
const bootstrap = () => {
|
| 88 |
console.log('[palettes] bootstrap start');
|
| 89 |
const mount = document.currentScript ? document.currentScript.previousElementSibling : null;
|
|
@@ -173,8 +174,8 @@
|
|
| 173 |
// Update current swatch + name
|
| 174 |
if (currentSwatch) currentSwatch.style.background = base.hex();
|
| 175 |
const getName = (hex) => {
|
| 176 |
-
// Prefer
|
| 177 |
-
const list = (window.__colorNames && window.__colorNames.length) ? window.__colorNames :
|
| 178 |
if (list && window.chroma) {
|
| 179 |
let bestName = null; let best = Infinity;
|
| 180 |
for (let i = 0; i < list.length; i++) {
|
|
@@ -184,8 +185,6 @@
|
|
| 184 |
}
|
| 185 |
if (bestName) return bestName;
|
| 186 |
}
|
| 187 |
-
// Fallback to ntc.js
|
| 188 |
-
try { if (window.ntc && window.ntc.name) { const res = window.ntc.name(hex); return res && res[1]; } } catch {}
|
| 189 |
// Hue-based coarse fallback
|
| 190 |
const hh = chroma(hex).get('hsl.h') || 0;
|
| 191 |
const labels = ['Red','Orange','Yellow','Lime','Green','Cyan','Blue','Indigo','Violet','Magenta'];
|
|
@@ -290,14 +289,8 @@
|
|
| 290 |
};
|
| 291 |
if (simSelect) simSelect.addEventListener('change', () => applySimulation(simSelect.value));
|
| 292 |
|
| 293 |
-
// Load extended color-name dataset, then initial render
|
| 294 |
-
const loadColorNames = () => {
|
| 295 |
-
if (window.__colorNames) return Promise.resolve(window.__colorNames);
|
| 296 |
-
const url = 'https://unpkg.com/color-name-list@10.2.0/dist/colornames.json';
|
| 297 |
-
return fetch(url).then(r => r.json()).then(arr => { window.__colorNames = arr; return arr; }).catch(() => []);
|
| 298 |
-
};
|
| 299 |
console.log('[palettes] initial render');
|
| 300 |
-
|
| 301 |
applySimulation('none');
|
| 302 |
|
| 303 |
// Fixed 3 columns layout
|
|
|
|
| 77 |
loadScript('chroma-cdn-fallback', 'https://cdnjs.cloudflare.com/ajax/libs/chroma-js/2.4.2/chroma.min.js', next);
|
| 78 |
});
|
| 79 |
};
|
| 80 |
+
// ntc.js removed; rely on embedded color-name list
|
| 81 |
+
ensureD3(() => ensureChroma(cb));
|
|
|
|
|
|
|
|
|
|
| 82 |
};
|
| 83 |
|
| 84 |
+
// Embedded reduced color-name list (~50 items), minified
|
| 85 |
+
const COLOR_NAMES=[{"name":"Candy Apple Red","hex":"#ff0800"},{"name":"Boiling Magma","hex":"#ff3300"},{"name":"Aerospace Orange","hex":"#ff4f00"},{"name":"Burtuqali Orange","hex":"#ff6700"},{"name":"American Orange","hex":"#ff8b00"},{"name":"Cheese","hex":"#ffa600"},{"name":"Amber","hex":"#ffbf00"},{"name":"Demonic Yellow","hex":"#ffe700"},{"name":"Bat-Signal","hex":"#feff00"},{"name":"Bitter Lime","hex":"#cfff00"},{"name":"Electric Lime","hex":"#ccff00"},{"name":"Bright Yellow Green","hex":"#9dff00"},{"name":"Lasting Lime","hex":"#88ff00"},{"name":"Bright Green","hex":"#66ff00"},{"name":"Chlorophyll Green","hex":"#4aff00"},{"name":"Green Screen","hex":"#22ff00"},{"name":"Electric Pickle","hex":"#00ff04"},{"name":"Acid","hex":"#00ff22"},{"name":"Lucent Lime","hex":"#00ff33"},{"name":"Cathode Green","hex":"#00ff55"},{"name":"Booger Buster","hex":"#00ff77"},{"name":"Green Gas","hex":"#00ff99"},{"name":"Enthusiasm","hex":"#00ffaa"},{"name":"Ice Ice Baby","hex":"#00ffdd"},{"name":"Master Sword Blue","hex":"#00ffee"},{"name":"Agressive Aqua","hex":"#00fbff"},{"name":"Vivid Sky Blue","hex":"#00ccff"},{"name":"Capri","hex":"#00bfff"},{"name":"Sky of Magritte","hex":"#0099ff"},{"name":"Azure","hex":"#007fff"},{"name":"Blue Ribbon","hex":"#0066ff"},{"name":"Blinking Blue","hex":"#0033ff"},{"name":"Icelandic Water","hex":"#0011ff"},{"name":"Blue","hex":"#0000ff"},{"name":"Blue Pencil","hex":"#2200ff"},{"name":"Electric Ultramarine","hex":"#3f00ff"},{"name":"Aladdin's Feather","hex":"#5500ff"},{"name":"Purple Climax","hex":"#8800ff"},{"name":"Amethyst Ganzstar","hex":"#8f00ff"},{"name":"Electric Purple","hex":"#bf00ff"},{"name":"Phlox","hex":"#df00ff"},{"name":"Brusque Pink","hex":"#ee00ff"},{"name":"Bright Magenta","hex":"#ff08e8"},{"name":"Brutal Pink","hex":"#ff00bb"},{"name":"Mean Girls Lipstick","hex":"#ff00ae"},{"name":"Big Bang Pink","hex":"#ff0099"},{"name":"Flaming Hot Flamingoes","hex":"#ff005d"},{"name":"Blazing Dragonfruit","hex":"#ff0054"},{"name":"Carmine Red","hex":"#ff0038"},{"name":"Bright Red","hex":"#ff000d"}];
|
| 86 |
+
window.__colorNames = COLOR_NAMES;
|
| 87 |
+
|
| 88 |
const bootstrap = () => {
|
| 89 |
console.log('[palettes] bootstrap start');
|
| 90 |
const mount = document.currentScript ? document.currentScript.previousElementSibling : null;
|
|
|
|
| 174 |
// Update current swatch + name
|
| 175 |
if (currentSwatch) currentSwatch.style.background = base.hex();
|
| 176 |
const getName = (hex) => {
|
| 177 |
+
// Prefer embedded reduced list
|
| 178 |
+
const list = (window.__colorNames && window.__colorNames.length) ? window.__colorNames : COLOR_NAMES;
|
| 179 |
if (list && window.chroma) {
|
| 180 |
let bestName = null; let best = Infinity;
|
| 181 |
for (let i = 0; i < list.length; i++) {
|
|
|
|
| 185 |
}
|
| 186 |
if (bestName) return bestName;
|
| 187 |
}
|
|
|
|
|
|
|
| 188 |
// Hue-based coarse fallback
|
| 189 |
const hh = chroma(hex).get('hsl.h') || 0;
|
| 190 |
const labels = ['Red','Orange','Yellow','Lime','Green','Cyan','Blue','Indigo','Violet','Magenta'];
|
|
|
|
| 289 |
};
|
| 290 |
if (simSelect) simSelect.addEventListener('change', () => applySimulation(simSelect.value));
|
| 291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
console.log('[palettes] initial render');
|
| 293 |
+
setHue(hue);
|
| 294 |
applySimulation('none');
|
| 295 |
|
| 296 |
// Fixed 3 columns layout
|
app/src/styles/components/_footer.scss
CHANGED
|
@@ -5,11 +5,9 @@
|
|
| 5 |
.citation-block,
|
| 6 |
.references-block { display: contents; }
|
| 7 |
.citation-block > h3,
|
| 8 |
-
.references-block > h3 { grid-column: 1; font-size: 15px; margin: 0; }
|
| 9 |
.citation-block > :not(h3),
|
| 10 |
.references-block > :not(h3) { grid-column: 2; }
|
| 11 |
-
.citation-block > h3 + *,
|
| 12 |
-
.references-block > h3 + * { margin-top: 1em; }
|
| 13 |
@media (max-width: 1100px) {
|
| 14 |
.footer-inner { grid-template-columns: 1fr; gap: 16px; }
|
| 15 |
.footer-inner > h3 { grid-column: auto; margin-top: 16px; }
|
|
@@ -17,6 +15,10 @@
|
|
| 17 |
.citation-block h3 { margin: 0 0 8px; }
|
| 18 |
.citation-block h4 { margin: 16px 0 8px; font-size: 14px; text-transform: uppercase; color: var(--muted-color); }
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
// Distill-like appendix citation styling
|
| 21 |
.citation {
|
| 22 |
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
@@ -40,8 +42,6 @@
|
|
| 40 |
.citation.short { margin-top: -4px; }
|
| 41 |
|
| 42 |
.references-block h3 { margin: 0; }
|
| 43 |
-
.references-block .footnotes { margin-top: 8px; }
|
| 44 |
-
.references-block .bibliography { margin-top: 8px; }
|
| 45 |
|
| 46 |
// Distill-like list styling for references/footnotes
|
| 47 |
.references-block ol { padding: 0 0 0 15px; }
|
|
|
|
| 5 |
.citation-block,
|
| 6 |
.references-block { display: contents; }
|
| 7 |
.citation-block > h3,
|
| 8 |
+
.references-block > h3 { grid-column: 1; font-size: 15px; margin: 0; text-align: right; padding-right: 30px; }
|
| 9 |
.citation-block > :not(h3),
|
| 10 |
.references-block > :not(h3) { grid-column: 2; }
|
|
|
|
|
|
|
| 11 |
@media (max-width: 1100px) {
|
| 12 |
.footer-inner { grid-template-columns: 1fr; gap: 16px; }
|
| 13 |
.footer-inner > h3 { grid-column: auto; margin-top: 16px; }
|
|
|
|
| 15 |
.citation-block h3 { margin: 0 0 8px; }
|
| 16 |
.citation-block h4 { margin: 16px 0 8px; font-size: 14px; text-transform: uppercase; color: var(--muted-color); }
|
| 17 |
|
| 18 |
+
.citation-block p, .references {
|
| 19 |
+
margin-top:0;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
// Distill-like appendix citation styling
|
| 23 |
.citation {
|
| 24 |
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
|
|
| 42 |
.citation.short { margin-top: -4px; }
|
| 43 |
|
| 44 |
.references-block h3 { margin: 0; }
|
|
|
|
|
|
|
| 45 |
|
| 46 |
// Distill-like list styling for references/footnotes
|
| 47 |
.references-block ol { padding: 0 0 0 15px; }
|