Spaces:
Running
Running
Vincent Warmerdam
commited on
Commit
·
77b9c0b
1
Parent(s):
a488e86
i can delete these files ... right?
Browse files- Makefile +6 -0
- scripts/build.py +144 -1392
- scripts/templates/index.html +177 -0
- scripts/templates/tailwind_base.html +53 -0
- scripts/templates/tailwind_contribute.html +12 -0
- scripts/templates/tailwind_courses.html +36 -0
- scripts/templates/tailwind_features.html +34 -0
- scripts/templates/tailwind_footer.html +21 -0
- scripts/templates/tailwind_hero.html +19 -0
Makefile
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
build:
|
| 2 |
+
rm -rf _site
|
| 3 |
+
uv run scripts/build.py
|
| 4 |
+
|
| 5 |
+
serve:
|
| 6 |
+
uv run python -m http.server --directory _site
|
scripts/build.py
CHANGED
|
@@ -4,1449 +4,201 @@ import os
|
|
| 4 |
import subprocess
|
| 5 |
import argparse
|
| 6 |
import json
|
| 7 |
-
|
|
|
|
| 8 |
from pathlib import Path
|
| 9 |
-
import
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
def export_html_wasm(notebook_path: str, output_dir: str, as_app: bool = False) -> bool:
|
| 13 |
"""Export a single marimo notebook to HTML format.
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
Returns:
|
| 16 |
bool: True if export succeeded, False otherwise
|
| 17 |
"""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
try:
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
cmd.extend([notebook_path, "-o", output_file])
|
| 33 |
-
print(f"Running command: {' '.join(cmd)}")
|
| 34 |
-
|
| 35 |
-
# Use Popen to handle interactive prompts
|
| 36 |
-
process = subprocess.Popen(
|
| 37 |
-
cmd,
|
| 38 |
-
stdin=subprocess.PIPE,
|
| 39 |
-
stdout=subprocess.PIPE,
|
| 40 |
-
stderr=subprocess.PIPE,
|
| 41 |
-
text=True
|
| 42 |
-
)
|
| 43 |
-
|
| 44 |
-
# Send 'Y' to the prompt
|
| 45 |
-
stdout, stderr = process.communicate(input="Y\n", timeout=60)
|
| 46 |
-
|
| 47 |
-
if process.returncode != 0:
|
| 48 |
-
print(f"Error exporting {notebook_path}:")
|
| 49 |
-
print(f"Command: {' '.join(cmd)}")
|
| 50 |
-
print(f"Return code: {process.returncode}")
|
| 51 |
-
print(f"Stdout: {stdout}")
|
| 52 |
-
print(f"Stderr: {stderr}")
|
| 53 |
-
return False
|
| 54 |
-
|
| 55 |
-
print(f"Successfully exported {notebook_path} to {output_file}")
|
| 56 |
return True
|
| 57 |
-
except subprocess.TimeoutExpired:
|
| 58 |
-
print(f"Timeout exporting {notebook_path} - command took too long to execute")
|
| 59 |
-
return False
|
| 60 |
except subprocess.CalledProcessError as e:
|
| 61 |
-
print(f"Error exporting {notebook_path}:")
|
| 62 |
-
print(e.
|
| 63 |
-
return False
|
| 64 |
-
except Exception as e:
|
| 65 |
-
print(f"Unexpected error exporting {notebook_path}: {e}")
|
| 66 |
return False
|
| 67 |
|
| 68 |
|
| 69 |
def get_course_metadata(course_dir: Path) -> Dict[str, Any]:
|
| 70 |
-
"""Extract metadata from a course directory.
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
}
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
| 79 |
readme_path = course_dir / "README.md"
|
|
|
|
|
|
|
|
|
|
| 80 |
if readme_path.exists():
|
| 81 |
with open(readme_path, "r", encoding="utf-8") as f:
|
| 82 |
content = f.read()
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
description = " ".join(description_lines).strip()
|
| 95 |
-
# Clean up the description
|
| 96 |
-
description = description.replace("_", "")
|
| 97 |
-
description = description.replace("[work in progress]", "")
|
| 98 |
-
description = description.replace("(https://github.com/marimo-team/learn/issues/51)", "")
|
| 99 |
-
# Remove any other GitHub issue links
|
| 100 |
-
description = re.sub(r'\[.*?\]\(https://github\.com/.*?/issues/\d+\)', '', description)
|
| 101 |
-
description = re.sub(r'https://github\.com/.*?/issues/\d+', '', description)
|
| 102 |
-
# Clean up any double spaces
|
| 103 |
-
description = re.sub(r'\s+', ' ', description).strip()
|
| 104 |
-
metadata["description"] = description
|
| 105 |
|
| 106 |
-
return
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
|
| 109 |
def organize_notebooks_by_course(all_notebooks: List[str]) -> Dict[str, Dict[str, Any]]:
|
| 110 |
-
"""Organize notebooks by course.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
courses = {}
|
| 112 |
|
| 113 |
-
for notebook_path in all_notebooks:
|
| 114 |
-
path
|
| 115 |
-
|
|
|
|
| 116 |
|
| 117 |
-
if
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
| 120 |
|
| 121 |
-
#
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
#
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
try:
|
| 129 |
-
order_str = notebook_id.split("_")[0]
|
| 130 |
-
order = int(order_str)
|
| 131 |
-
except ValueError:
|
| 132 |
-
pass
|
| 133 |
|
| 134 |
-
#
|
| 135 |
-
|
| 136 |
-
if "_" in notebook_id:
|
| 137 |
-
display_name = "_".join(notebook_id.split("_")[1:])
|
| 138 |
|
| 139 |
-
#
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
# Skip empty parts that might come from consecutive underscores
|
| 147 |
-
i += 2
|
| 148 |
-
continue
|
| 149 |
-
|
| 150 |
-
if i + 1 < len(parts) and (parts[i] == "" or parts[i+1] == ""):
|
| 151 |
-
# This is an italics marker
|
| 152 |
-
if parts[i] == "":
|
| 153 |
-
# Opening italics
|
| 154 |
-
text_part = parts[i+1].replace("_", " ").title()
|
| 155 |
-
formatted_parts.append(f"<em>{text_part}</em>")
|
| 156 |
-
i += 2
|
| 157 |
-
else:
|
| 158 |
-
# Text followed by italics marker
|
| 159 |
-
text_part = parts[i].replace("_", " ").title()
|
| 160 |
-
formatted_parts.append(text_part)
|
| 161 |
-
i += 1
|
| 162 |
-
else:
|
| 163 |
-
# Regular text
|
| 164 |
-
text_part = parts[i].replace("_", " ").title()
|
| 165 |
-
formatted_parts.append(text_part)
|
| 166 |
-
i += 1
|
| 167 |
|
| 168 |
-
|
|
|
|
| 169 |
|
|
|
|
| 170 |
courses[course_id]["notebooks"].append({
|
| 171 |
-
"id": notebook_id,
|
| 172 |
"path": notebook_path,
|
| 173 |
-
"
|
| 174 |
-
"
|
| 175 |
-
"
|
|
|
|
| 176 |
})
|
| 177 |
|
| 178 |
-
# Sort notebooks by
|
| 179 |
-
for course_id in courses:
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
return courses
|
| 183 |
|
| 184 |
|
| 185 |
-
def
|
| 186 |
-
"""Generate
|
| 187 |
-
return """
|
| 188 |
-
:root {
|
| 189 |
-
/* Light mode colors (default) */
|
| 190 |
-
--eva-purple: #7209b7;
|
| 191 |
-
--eva-green: #1c7361;
|
| 192 |
-
--eva-orange: #e65100;
|
| 193 |
-
--eva-blue: #0039cb;
|
| 194 |
-
--eva-red: #c62828;
|
| 195 |
-
--eva-black: #f5f5f5;
|
| 196 |
-
--eva-dark: #e0e0e0;
|
| 197 |
-
--eva-terminal-bg: rgba(255, 255, 255, 0.9);
|
| 198 |
-
--eva-text: #333333;
|
| 199 |
-
--eva-border-radius: 4px;
|
| 200 |
-
--eva-transition: all 0.3s ease;
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
/* Dark mode colors */
|
| 204 |
-
[data-theme="dark"] {
|
| 205 |
-
--eva-purple: #9a1eb3;
|
| 206 |
-
--eva-green: #1c7361;
|
| 207 |
-
--eva-orange: #ff6600;
|
| 208 |
-
--eva-blue: #0066ff;
|
| 209 |
-
--eva-red: #ff0000;
|
| 210 |
-
--eva-black: #111111;
|
| 211 |
-
--eva-dark: #222222;
|
| 212 |
-
--eva-terminal-bg: rgba(0, 0, 0, 0.85);
|
| 213 |
-
--eva-text: #e0e0e0;
|
| 214 |
-
}
|
| 215 |
-
|
| 216 |
-
body {
|
| 217 |
-
background-color: var(--eva-black);
|
| 218 |
-
color: var(--eva-text);
|
| 219 |
-
font-family: 'Courier New', monospace;
|
| 220 |
-
margin: 0;
|
| 221 |
-
padding: 0;
|
| 222 |
-
line-height: 1.6;
|
| 223 |
-
transition: background-color 0.3s ease, color 0.3s ease;
|
| 224 |
-
}
|
| 225 |
-
|
| 226 |
-
.eva-container {
|
| 227 |
-
max-width: 1200px;
|
| 228 |
-
margin: 0 auto;
|
| 229 |
-
padding: 2rem;
|
| 230 |
-
}
|
| 231 |
-
|
| 232 |
-
.eva-header {
|
| 233 |
-
border-bottom: 2px solid var(--eva-green);
|
| 234 |
-
padding-bottom: 1rem;
|
| 235 |
-
margin-bottom: 2rem;
|
| 236 |
-
display: flex;
|
| 237 |
-
justify-content: space-between;
|
| 238 |
-
align-items: center;
|
| 239 |
-
position: sticky;
|
| 240 |
-
top: 0;
|
| 241 |
-
background-color: var(--eva-black);
|
| 242 |
-
z-index: 100;
|
| 243 |
-
backdrop-filter: blur(5px);
|
| 244 |
-
padding-top: 1rem;
|
| 245 |
-
transition: background-color 0.3s ease;
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
[data-theme="light"] .eva-header {
|
| 249 |
-
background-color: rgba(245, 245, 245, 0.95);
|
| 250 |
-
}
|
| 251 |
-
|
| 252 |
-
.eva-logo {
|
| 253 |
-
font-size: 2.5rem;
|
| 254 |
-
font-weight: bold;
|
| 255 |
-
color: var(--eva-green);
|
| 256 |
-
text-transform: uppercase;
|
| 257 |
-
letter-spacing: 2px;
|
| 258 |
-
text-shadow: 0 0 10px rgba(28, 115, 97, 0.5);
|
| 259 |
-
}
|
| 260 |
-
|
| 261 |
-
[data-theme="light"] .eva-logo {
|
| 262 |
-
text-shadow: 0 0 10px rgba(28, 115, 97, 0.3);
|
| 263 |
-
}
|
| 264 |
-
|
| 265 |
-
.eva-nav {
|
| 266 |
-
display: flex;
|
| 267 |
-
gap: 1.5rem;
|
| 268 |
-
align-items: center;
|
| 269 |
-
}
|
| 270 |
-
|
| 271 |
-
.eva-nav a {
|
| 272 |
-
color: var(--eva-text);
|
| 273 |
-
text-decoration: none;
|
| 274 |
-
text-transform: uppercase;
|
| 275 |
-
font-size: 0.9rem;
|
| 276 |
-
letter-spacing: 1px;
|
| 277 |
-
transition: color 0.3s;
|
| 278 |
-
position: relative;
|
| 279 |
-
padding: 0.5rem 0;
|
| 280 |
-
}
|
| 281 |
-
|
| 282 |
-
.eva-nav a:hover {
|
| 283 |
-
color: var(--eva-green);
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
-
.eva-nav a:hover::after {
|
| 287 |
-
content: '';
|
| 288 |
-
position: absolute;
|
| 289 |
-
bottom: -5px;
|
| 290 |
-
left: 0;
|
| 291 |
-
width: 100%;
|
| 292 |
-
height: 2px;
|
| 293 |
-
background-color: var(--eva-green);
|
| 294 |
-
animation: scanline 1.5s linear infinite;
|
| 295 |
-
}
|
| 296 |
-
|
| 297 |
-
.theme-toggle {
|
| 298 |
-
background: none;
|
| 299 |
-
border: none;
|
| 300 |
-
color: var(--eva-text);
|
| 301 |
-
cursor: pointer;
|
| 302 |
-
font-size: 1.2rem;
|
| 303 |
-
padding: 0.5rem;
|
| 304 |
-
margin-left: 1rem;
|
| 305 |
-
transition: color 0.3s;
|
| 306 |
-
}
|
| 307 |
-
|
| 308 |
-
.theme-toggle:hover {
|
| 309 |
-
color: var(--eva-green);
|
| 310 |
-
}
|
| 311 |
-
|
| 312 |
-
.eva-hero {
|
| 313 |
-
background-color: var(--eva-terminal-bg);
|
| 314 |
-
border: 1px solid var(--eva-green);
|
| 315 |
-
padding: 3rem 2rem;
|
| 316 |
-
margin-bottom: 3rem;
|
| 317 |
-
position: relative;
|
| 318 |
-
overflow: hidden;
|
| 319 |
-
border-radius: var(--eva-border-radius);
|
| 320 |
-
display: flex;
|
| 321 |
-
flex-direction: column;
|
| 322 |
-
align-items: flex-start;
|
| 323 |
-
background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7)), url('https://raw.githubusercontent.com/marimo-team/marimo/main/docs/_static/marimo-logotype-thick.svg');
|
| 324 |
-
background-size: cover;
|
| 325 |
-
background-position: center;
|
| 326 |
-
background-blend-mode: overlay;
|
| 327 |
-
transition: background-color 0.3s ease, border-color 0.3s ease;
|
| 328 |
-
}
|
| 329 |
-
|
| 330 |
-
[data-theme="light"] .eva-hero {
|
| 331 |
-
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7)), url('https://raw.githubusercontent.com/marimo-team/marimo/main/docs/_static/marimo-logotype-thick.svg');
|
| 332 |
-
}
|
| 333 |
-
|
| 334 |
-
.eva-hero::before {
|
| 335 |
-
content: '';
|
| 336 |
-
position: absolute;
|
| 337 |
-
top: 0;
|
| 338 |
-
left: 0;
|
| 339 |
-
width: 100%;
|
| 340 |
-
height: 2px;
|
| 341 |
-
background-color: var(--eva-green);
|
| 342 |
-
animation: scanline 3s linear infinite;
|
| 343 |
-
}
|
| 344 |
-
|
| 345 |
-
.eva-hero h1 {
|
| 346 |
-
font-size: 2.5rem;
|
| 347 |
-
margin-bottom: 1rem;
|
| 348 |
-
color: var(--eva-green);
|
| 349 |
-
text-transform: uppercase;
|
| 350 |
-
letter-spacing: 2px;
|
| 351 |
-
text-shadow: 0 0 10px rgba(28, 115, 97, 0.5);
|
| 352 |
-
}
|
| 353 |
-
|
| 354 |
-
[data-theme="light"] .eva-hero h1 {
|
| 355 |
-
text-shadow: 0 0 10px rgba(28, 115, 97, 0.3);
|
| 356 |
-
}
|
| 357 |
-
|
| 358 |
-
.eva-hero p {
|
| 359 |
-
font-size: 1.1rem;
|
| 360 |
-
max-width: 800px;
|
| 361 |
-
margin-bottom: 2rem;
|
| 362 |
-
line-height: 1.8;
|
| 363 |
-
}
|
| 364 |
-
|
| 365 |
-
.eva-features {
|
| 366 |
-
display: grid;
|
| 367 |
-
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
| 368 |
-
gap: 2rem;
|
| 369 |
-
margin-bottom: 3rem;
|
| 370 |
-
}
|
| 371 |
-
|
| 372 |
-
.eva-feature {
|
| 373 |
-
background-color: var(--eva-terminal-bg);
|
| 374 |
-
border: 1px solid var(--eva-blue);
|
| 375 |
-
padding: 1.5rem;
|
| 376 |
-
border-radius: var(--eva-border-radius);
|
| 377 |
-
transition: var(--eva-transition);
|
| 378 |
-
position: relative;
|
| 379 |
-
overflow: hidden;
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
-
.eva-feature:hover {
|
| 383 |
-
transform: translateY(-5px);
|
| 384 |
-
box-shadow: 0 10px 20px rgba(0, 102, 255, 0.2);
|
| 385 |
-
}
|
| 386 |
-
|
| 387 |
-
.eva-feature-icon {
|
| 388 |
-
font-size: 2rem;
|
| 389 |
-
margin-bottom: 1rem;
|
| 390 |
-
color: var(--eva-blue);
|
| 391 |
-
}
|
| 392 |
-
|
| 393 |
-
.eva-feature h3 {
|
| 394 |
-
font-size: 1.3rem;
|
| 395 |
-
margin-bottom: 1rem;
|
| 396 |
-
color: var(--eva-blue);
|
| 397 |
-
}
|
| 398 |
-
|
| 399 |
-
.eva-section-title {
|
| 400 |
-
font-size: 2rem;
|
| 401 |
-
color: var(--eva-green);
|
| 402 |
-
margin-bottom: 2rem;
|
| 403 |
-
text-transform: uppercase;
|
| 404 |
-
letter-spacing: 2px;
|
| 405 |
-
text-align: center;
|
| 406 |
-
position: relative;
|
| 407 |
-
padding-bottom: 1rem;
|
| 408 |
-
}
|
| 409 |
-
|
| 410 |
-
.eva-section-title::after {
|
| 411 |
-
content: '';
|
| 412 |
-
position: absolute;
|
| 413 |
-
bottom: 0;
|
| 414 |
-
left: 50%;
|
| 415 |
-
transform: translateX(-50%);
|
| 416 |
-
width: 100px;
|
| 417 |
-
height: 2px;
|
| 418 |
-
background-color: var(--eva-green);
|
| 419 |
-
}
|
| 420 |
-
|
| 421 |
-
/* Flashcard view for courses */
|
| 422 |
-
.eva-courses {
|
| 423 |
-
display: grid;
|
| 424 |
-
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
| 425 |
-
gap: 2rem;
|
| 426 |
-
}
|
| 427 |
-
|
| 428 |
-
.eva-course {
|
| 429 |
-
background-color: var(--eva-terminal-bg);
|
| 430 |
-
border: 1px solid var(--eva-purple);
|
| 431 |
-
border-radius: var(--eva-border-radius);
|
| 432 |
-
transition: var(--eva-transition), height 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
| 433 |
-
position: relative;
|
| 434 |
-
overflow: hidden;
|
| 435 |
-
height: 350px;
|
| 436 |
-
display: flex;
|
| 437 |
-
flex-direction: column;
|
| 438 |
-
}
|
| 439 |
-
|
| 440 |
-
.eva-course:hover {
|
| 441 |
-
transform: translateY(-5px);
|
| 442 |
-
box-shadow: 0 10px 20px rgba(154, 30, 179, 0.3);
|
| 443 |
-
}
|
| 444 |
-
|
| 445 |
-
.eva-course::after {
|
| 446 |
-
content: '';
|
| 447 |
-
position: absolute;
|
| 448 |
-
bottom: 0;
|
| 449 |
-
left: 0;
|
| 450 |
-
width: 100%;
|
| 451 |
-
height: 2px;
|
| 452 |
-
background-color: var(--eva-purple);
|
| 453 |
-
animation: scanline 2s linear infinite;
|
| 454 |
-
}
|
| 455 |
-
|
| 456 |
-
.eva-course-badge {
|
| 457 |
-
position: absolute;
|
| 458 |
-
top: 15px;
|
| 459 |
-
right: -40px;
|
| 460 |
-
background: linear-gradient(135deg, var(--eva-orange) 0%, #ff9500 100%);
|
| 461 |
-
color: var(--eva-black);
|
| 462 |
-
font-size: 0.65rem;
|
| 463 |
-
padding: 0.3rem 2.5rem;
|
| 464 |
-
text-transform: uppercase;
|
| 465 |
-
font-weight: bold;
|
| 466 |
-
z-index: 3;
|
| 467 |
-
letter-spacing: 1px;
|
| 468 |
-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
| 469 |
-
transform: rotate(45deg);
|
| 470 |
-
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
|
| 471 |
-
border-top: 1px solid rgba(255, 255, 255, 0.3);
|
| 472 |
-
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
|
| 473 |
-
white-space: nowrap;
|
| 474 |
-
overflow: hidden;
|
| 475 |
-
}
|
| 476 |
-
|
| 477 |
-
.eva-course-badge i {
|
| 478 |
-
margin-right: 4px;
|
| 479 |
-
font-size: 0.7rem;
|
| 480 |
-
}
|
| 481 |
-
|
| 482 |
-
[data-theme="light"] .eva-course-badge {
|
| 483 |
-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
| 484 |
-
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
|
| 485 |
-
}
|
| 486 |
-
|
| 487 |
-
.eva-course-badge::before {
|
| 488 |
-
content: '';
|
| 489 |
-
position: absolute;
|
| 490 |
-
left: 0;
|
| 491 |
-
top: 0;
|
| 492 |
-
width: 100%;
|
| 493 |
-
height: 100%;
|
| 494 |
-
background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
|
| 495 |
-
animation: scanline 2s linear infinite;
|
| 496 |
-
}
|
| 497 |
-
|
| 498 |
-
.eva-course-header {
|
| 499 |
-
padding: 1rem 1.5rem;
|
| 500 |
-
cursor: pointer;
|
| 501 |
-
display: flex;
|
| 502 |
-
justify-content: space-between;
|
| 503 |
-
align-items: center;
|
| 504 |
-
border-bottom: 1px solid rgba(154, 30, 179, 0.3);
|
| 505 |
-
z-index: 2;
|
| 506 |
-
background-color: var(--eva-terminal-bg);
|
| 507 |
-
position: absolute;
|
| 508 |
-
top: 0;
|
| 509 |
-
left: 0;
|
| 510 |
-
width: 100%;
|
| 511 |
-
height: 3.5rem;
|
| 512 |
-
box-sizing: border-box;
|
| 513 |
-
}
|
| 514 |
-
|
| 515 |
-
.eva-course-title {
|
| 516 |
-
font-size: 1.3rem;
|
| 517 |
-
color: var(--eva-purple);
|
| 518 |
-
text-transform: uppercase;
|
| 519 |
-
letter-spacing: 1px;
|
| 520 |
-
margin: 0;
|
| 521 |
-
}
|
| 522 |
-
|
| 523 |
-
.eva-course-toggle {
|
| 524 |
-
color: var(--eva-purple);
|
| 525 |
-
font-size: 1.5rem;
|
| 526 |
-
transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
| 527 |
-
}
|
| 528 |
-
|
| 529 |
-
.eva-course.active .eva-course-toggle {
|
| 530 |
-
transform: rotate(180deg);
|
| 531 |
-
}
|
| 532 |
-
|
| 533 |
-
.eva-course-front {
|
| 534 |
-
display: flex;
|
| 535 |
-
flex-direction: column;
|
| 536 |
-
justify-content: space-between;
|
| 537 |
-
padding: 1.5rem;
|
| 538 |
-
margin-top: 3.5rem;
|
| 539 |
-
transition: opacity 0.3s ease, transform 0.3s ease;
|
| 540 |
-
position: absolute;
|
| 541 |
-
top: 0;
|
| 542 |
-
left: 0;
|
| 543 |
-
width: 100%;
|
| 544 |
-
height: calc(100% - 3.5rem);
|
| 545 |
-
background-color: var(--eva-terminal-bg);
|
| 546 |
-
z-index: 1;
|
| 547 |
-
box-sizing: border-box;
|
| 548 |
-
}
|
| 549 |
-
|
| 550 |
-
.eva-course.active .eva-course-front {
|
| 551 |
-
opacity: 0;
|
| 552 |
-
transform: translateY(-10px);
|
| 553 |
-
pointer-events: none;
|
| 554 |
-
}
|
| 555 |
-
|
| 556 |
-
.eva-course-description {
|
| 557 |
-
margin-top: 0.5rem;
|
| 558 |
-
margin-bottom: 1.5rem;
|
| 559 |
-
font-size: 0.9rem;
|
| 560 |
-
line-height: 1.6;
|
| 561 |
-
flex-grow: 1;
|
| 562 |
-
overflow: hidden;
|
| 563 |
-
display: -webkit-box;
|
| 564 |
-
-webkit-line-clamp: 4;
|
| 565 |
-
-webkit-box-orient: vertical;
|
| 566 |
-
max-height: 150px;
|
| 567 |
-
}
|
| 568 |
-
|
| 569 |
-
.eva-course-stats {
|
| 570 |
-
display: flex;
|
| 571 |
-
justify-content: space-between;
|
| 572 |
-
font-size: 0.8rem;
|
| 573 |
-
color: var(--eva-text);
|
| 574 |
-
opacity: 0.7;
|
| 575 |
-
}
|
| 576 |
-
|
| 577 |
-
.eva-course-content {
|
| 578 |
-
position: absolute;
|
| 579 |
-
top: 3.5rem;
|
| 580 |
-
left: 0;
|
| 581 |
-
width: 100%;
|
| 582 |
-
height: calc(100% - 3.5rem);
|
| 583 |
-
padding: 1.5rem;
|
| 584 |
-
background-color: var(--eva-terminal-bg);
|
| 585 |
-
transition: opacity 0.3s ease, transform 0.3s ease;
|
| 586 |
-
opacity: 0;
|
| 587 |
-
transform: translateY(10px);
|
| 588 |
-
pointer-events: none;
|
| 589 |
-
overflow-y: auto;
|
| 590 |
-
z-index: 1;
|
| 591 |
-
box-sizing: border-box;
|
| 592 |
-
}
|
| 593 |
-
|
| 594 |
-
.eva-course.active .eva-course-content {
|
| 595 |
-
opacity: 1;
|
| 596 |
-
transform: translateY(0);
|
| 597 |
-
pointer-events: auto;
|
| 598 |
-
}
|
| 599 |
-
|
| 600 |
-
.eva-course.active {
|
| 601 |
-
height: auto;
|
| 602 |
-
min-height: 350px;
|
| 603 |
-
max-height: 800px;
|
| 604 |
-
transition: height 0.4s cubic-bezier(0.19, 1, 0.22, 1), transform 0.3s ease, box-shadow 0.3s ease;
|
| 605 |
-
}
|
| 606 |
-
|
| 607 |
-
.eva-notebooks {
|
| 608 |
-
margin-top: 1rem;
|
| 609 |
-
display: grid;
|
| 610 |
-
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
| 611 |
-
gap: 0.75rem;
|
| 612 |
-
}
|
| 613 |
-
|
| 614 |
-
.eva-notebook {
|
| 615 |
-
margin-bottom: 0.5rem;
|
| 616 |
-
padding: 0.75rem;
|
| 617 |
-
border-left: 2px solid var(--eva-blue);
|
| 618 |
-
transition: all 0.25s ease;
|
| 619 |
-
display: flex;
|
| 620 |
-
align-items: center;
|
| 621 |
-
background-color: rgba(0, 0, 0, 0.2);
|
| 622 |
-
border-radius: 0 var(--eva-border-radius) var(--eva-border-radius) 0;
|
| 623 |
-
opacity: 1;
|
| 624 |
-
transform: translateX(0);
|
| 625 |
-
}
|
| 626 |
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
}
|
| 630 |
-
|
| 631 |
-
.eva-notebook:hover {
|
| 632 |
-
background-color: rgba(0, 102, 255, 0.1);
|
| 633 |
-
padding-left: 1rem;
|
| 634 |
-
transform: translateX(3px);
|
| 635 |
-
}
|
| 636 |
-
|
| 637 |
-
.eva-notebook a {
|
| 638 |
-
color: var(--eva-text);
|
| 639 |
-
text-decoration: none;
|
| 640 |
-
display: block;
|
| 641 |
-
font-size: 0.9rem;
|
| 642 |
-
flex-grow: 1;
|
| 643 |
-
}
|
| 644 |
-
|
| 645 |
-
.eva-notebook a:hover {
|
| 646 |
-
color: var(--eva-blue);
|
| 647 |
-
}
|
| 648 |
-
|
| 649 |
-
.eva-notebook-number {
|
| 650 |
-
color: var(--eva-blue);
|
| 651 |
-
font-size: 0.8rem;
|
| 652 |
-
margin-right: 0.75rem;
|
| 653 |
-
opacity: 0.7;
|
| 654 |
-
min-width: 24px;
|
| 655 |
-
font-weight: bold;
|
| 656 |
-
}
|
| 657 |
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
color: var(--eva-green);
|
| 662 |
-
border: 1px solid var(--eva-green);
|
| 663 |
-
padding: 0.7rem 1.5rem;
|
| 664 |
-
text-decoration: none;
|
| 665 |
-
text-transform: uppercase;
|
| 666 |
-
font-size: 0.9rem;
|
| 667 |
-
letter-spacing: 1px;
|
| 668 |
-
transition: var(--eva-transition);
|
| 669 |
-
cursor: pointer;
|
| 670 |
-
border-radius: var(--eva-border-radius);
|
| 671 |
-
position: relative;
|
| 672 |
-
overflow: hidden;
|
| 673 |
-
}
|
| 674 |
-
|
| 675 |
-
.eva-button:hover {
|
| 676 |
-
background-color: var(--eva-green);
|
| 677 |
-
color: var(--eva-black);
|
| 678 |
-
}
|
| 679 |
-
|
| 680 |
-
.eva-button::after {
|
| 681 |
-
content: '';
|
| 682 |
-
position: absolute;
|
| 683 |
-
top: 0;
|
| 684 |
-
left: -100%;
|
| 685 |
-
width: 100%;
|
| 686 |
-
height: 100%;
|
| 687 |
-
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
| 688 |
-
transition: 0.5s;
|
| 689 |
-
}
|
| 690 |
-
|
| 691 |
-
.eva-button:hover::after {
|
| 692 |
-
left: 100%;
|
| 693 |
-
}
|
| 694 |
-
|
| 695 |
-
.eva-course-button {
|
| 696 |
-
margin-top: 1rem;
|
| 697 |
-
margin-bottom: 1rem;
|
| 698 |
-
align-self: center;
|
| 699 |
-
}
|
| 700 |
-
|
| 701 |
-
.eva-cta {
|
| 702 |
-
background-color: var(--eva-terminal-bg);
|
| 703 |
-
border: 1px solid var(--eva-orange);
|
| 704 |
-
padding: 3rem 2rem;
|
| 705 |
-
margin: 4rem 0;
|
| 706 |
-
text-align: center;
|
| 707 |
-
border-radius: var(--eva-border-radius);
|
| 708 |
-
position: relative;
|
| 709 |
-
overflow: hidden;
|
| 710 |
-
}
|
| 711 |
-
|
| 712 |
-
.eva-cta h2 {
|
| 713 |
-
font-size: 2rem;
|
| 714 |
-
color: var(--eva-orange);
|
| 715 |
-
margin-bottom: 1.5rem;
|
| 716 |
-
text-transform: uppercase;
|
| 717 |
-
}
|
| 718 |
-
|
| 719 |
-
.eva-cta p {
|
| 720 |
-
max-width: 600px;
|
| 721 |
-
margin: 0 auto 2rem;
|
| 722 |
-
font-size: 1.1rem;
|
| 723 |
-
}
|
| 724 |
-
|
| 725 |
-
.eva-cta .eva-button {
|
| 726 |
-
color: var(--eva-orange);
|
| 727 |
-
border-color: var(--eva-orange);
|
| 728 |
-
}
|
| 729 |
-
|
| 730 |
-
.eva-cta .eva-button:hover {
|
| 731 |
-
background-color: var(--eva-orange);
|
| 732 |
-
color: var(--eva-black);
|
| 733 |
-
}
|
| 734 |
-
|
| 735 |
-
.eva-footer {
|
| 736 |
-
margin-top: 4rem;
|
| 737 |
-
padding-top: 2rem;
|
| 738 |
-
border-top: 2px solid var(--eva-green);
|
| 739 |
-
display: flex;
|
| 740 |
-
flex-direction: column;
|
| 741 |
-
align-items: center;
|
| 742 |
-
gap: 2rem;
|
| 743 |
-
}
|
| 744 |
-
|
| 745 |
-
.eva-footer-logo {
|
| 746 |
-
max-width: 200px;
|
| 747 |
-
margin-bottom: 1rem;
|
| 748 |
-
}
|
| 749 |
-
|
| 750 |
-
.eva-footer-links {
|
| 751 |
-
display: flex;
|
| 752 |
-
gap: 1.5rem;
|
| 753 |
-
margin-bottom: 1.5rem;
|
| 754 |
-
}
|
| 755 |
-
|
| 756 |
-
.eva-footer-links a {
|
| 757 |
-
color: var(--eva-text);
|
| 758 |
-
text-decoration: none;
|
| 759 |
-
transition: var(--eva-transition);
|
| 760 |
-
}
|
| 761 |
-
|
| 762 |
-
.eva-footer-links a:hover {
|
| 763 |
-
color: var(--eva-green);
|
| 764 |
-
}
|
| 765 |
-
|
| 766 |
-
.eva-social-links {
|
| 767 |
-
display: flex;
|
| 768 |
-
gap: 1.5rem;
|
| 769 |
-
margin-bottom: 1.5rem;
|
| 770 |
-
}
|
| 771 |
-
|
| 772 |
-
.eva-social-links a {
|
| 773 |
-
color: var(--eva-text);
|
| 774 |
-
font-size: 1.5rem;
|
| 775 |
-
transition: var(--eva-transition);
|
| 776 |
-
}
|
| 777 |
-
|
| 778 |
-
.eva-social-links a:hover {
|
| 779 |
-
color: var(--eva-green);
|
| 780 |
-
transform: translateY(-3px);
|
| 781 |
-
}
|
| 782 |
-
|
| 783 |
-
.eva-footer-copyright {
|
| 784 |
-
font-size: 0.9rem;
|
| 785 |
-
text-align: center;
|
| 786 |
-
}
|
| 787 |
-
|
| 788 |
-
.eva-search {
|
| 789 |
-
position: relative;
|
| 790 |
-
margin-bottom: 3rem;
|
| 791 |
-
}
|
| 792 |
-
|
| 793 |
-
.eva-search input {
|
| 794 |
-
width: 100%;
|
| 795 |
-
padding: 1rem;
|
| 796 |
-
background-color: var(--eva-terminal-bg);
|
| 797 |
-
border: 1px solid var(--eva-green);
|
| 798 |
-
color: var(--eva-text);
|
| 799 |
-
font-family: 'Courier New', monospace;
|
| 800 |
-
font-size: 1rem;
|
| 801 |
-
border-radius: var(--eva-border-radius);
|
| 802 |
-
outline: none;
|
| 803 |
-
transition: var(--eva-transition);
|
| 804 |
-
}
|
| 805 |
-
|
| 806 |
-
.eva-search input:focus {
|
| 807 |
-
box-shadow: 0 0 10px rgba(28, 115, 97, 0.3);
|
| 808 |
-
}
|
| 809 |
-
|
| 810 |
-
.eva-search input::placeholder {
|
| 811 |
-
color: rgba(224, 224, 224, 0.5);
|
| 812 |
-
}
|
| 813 |
-
|
| 814 |
-
[data-theme="light"] .eva-search input::placeholder {
|
| 815 |
-
color: rgba(51, 51, 51, 0.5);
|
| 816 |
-
}
|
| 817 |
-
|
| 818 |
-
.eva-search-icon {
|
| 819 |
-
position: absolute;
|
| 820 |
-
right: 1rem;
|
| 821 |
-
top: 50%;
|
| 822 |
-
transform: translateY(-50%);
|
| 823 |
-
color: var(--eva-green);
|
| 824 |
-
font-size: 1.2rem;
|
| 825 |
-
}
|
| 826 |
-
|
| 827 |
-
@keyframes scanline {
|
| 828 |
-
0% {
|
| 829 |
-
transform: translateX(-100%);
|
| 830 |
-
}
|
| 831 |
-
100% {
|
| 832 |
-
transform: translateX(100%);
|
| 833 |
-
}
|
| 834 |
-
}
|
| 835 |
-
|
| 836 |
-
@keyframes blink {
|
| 837 |
-
0%, 100% {
|
| 838 |
-
opacity: 1;
|
| 839 |
-
}
|
| 840 |
-
50% {
|
| 841 |
-
opacity: 0;
|
| 842 |
-
}
|
| 843 |
-
}
|
| 844 |
-
|
| 845 |
-
.eva-cursor {
|
| 846 |
-
display: inline-block;
|
| 847 |
-
width: 10px;
|
| 848 |
-
height: 1.2em;
|
| 849 |
-
background-color: var(--eva-green);
|
| 850 |
-
margin-left: 2px;
|
| 851 |
-
animation: blink 1s infinite;
|
| 852 |
-
vertical-align: middle;
|
| 853 |
-
}
|
| 854 |
-
|
| 855 |
-
@media (max-width: 768px) {
|
| 856 |
-
.eva-courses {
|
| 857 |
-
grid-template-columns: 1fr;
|
| 858 |
-
}
|
| 859 |
-
|
| 860 |
-
.eva-header {
|
| 861 |
-
flex-direction: column;
|
| 862 |
-
align-items: flex-start;
|
| 863 |
-
padding: 1rem;
|
| 864 |
-
}
|
| 865 |
-
|
| 866 |
-
.eva-nav {
|
| 867 |
-
margin-top: 1rem;
|
| 868 |
-
flex-wrap: wrap;
|
| 869 |
-
}
|
| 870 |
-
|
| 871 |
-
.eva-hero {
|
| 872 |
-
padding: 2rem 1rem;
|
| 873 |
-
}
|
| 874 |
-
|
| 875 |
-
.eva-hero h1 {
|
| 876 |
-
font-size: 2rem;
|
| 877 |
-
}
|
| 878 |
-
|
| 879 |
-
.eva-features {
|
| 880 |
-
grid-template-columns: 1fr;
|
| 881 |
-
}
|
| 882 |
-
|
| 883 |
-
.eva-footer {
|
| 884 |
-
flex-direction: column;
|
| 885 |
-
align-items: center;
|
| 886 |
-
text-align: center;
|
| 887 |
-
}
|
| 888 |
-
|
| 889 |
-
.eva-notebooks {
|
| 890 |
-
grid-template-columns: 1fr;
|
| 891 |
-
}
|
| 892 |
-
}
|
| 893 |
-
|
| 894 |
-
.eva-course.closing .eva-course-content {
|
| 895 |
-
opacity: 0;
|
| 896 |
-
transform: translateY(10px);
|
| 897 |
-
transition: opacity 0.2s ease, transform 0.2s ease;
|
| 898 |
-
}
|
| 899 |
-
|
| 900 |
-
.eva-course.closing .eva-course-front {
|
| 901 |
-
opacity: 1;
|
| 902 |
-
transform: translateY(0);
|
| 903 |
-
transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
|
| 904 |
-
}
|
| 905 |
"""
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
def get_html_header():
|
| 909 |
-
"""Generate the HTML header with CSS and meta tags."""
|
| 910 |
-
return """<!DOCTYPE html>
|
| 911 |
-
<html lang="en" data-theme="light">
|
| 912 |
-
<head>
|
| 913 |
-
<meta charset="UTF-8">
|
| 914 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 915 |
-
<title>Marimo Learn - Interactive Educational Notebooks</title>
|
| 916 |
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 917 |
-
<style>
|
| 918 |
-
{css}
|
| 919 |
-
</style>
|
| 920 |
-
</head>
|
| 921 |
-
<body>
|
| 922 |
-
<div class="eva-container">
|
| 923 |
-
<header class="eva-header">
|
| 924 |
-
<div class="eva-logo">MARIMO LEARN</div>
|
| 925 |
-
<nav class="eva-nav">
|
| 926 |
-
<a href="#features">Features</a>
|
| 927 |
-
<a href="#courses">Courses</a>
|
| 928 |
-
<a href="#contribute">Contribute</a>
|
| 929 |
-
<a href="https://docs.marimo.io" target="_blank">Documentation</a>
|
| 930 |
-
<a href="https://github.com/marimo-team/learn" target="_blank">GitHub</a>
|
| 931 |
-
<button id="themeToggle" class="theme-toggle" aria-label="Toggle dark/light mode">
|
| 932 |
-
<i class="fas fa-moon"></i>
|
| 933 |
-
</button>
|
| 934 |
-
</nav>
|
| 935 |
-
</header>"""
|
| 936 |
-
|
| 937 |
-
|
| 938 |
-
def get_html_hero_section():
|
| 939 |
-
"""Generate the hero section of the page."""
|
| 940 |
-
return """
|
| 941 |
-
<section class="eva-hero">
|
| 942 |
-
<h1>Interactive Learning with Marimo<span class="eva-cursor"></span></h1>
|
| 943 |
-
<p>
|
| 944 |
-
A curated collection of educational notebooks covering computer science,
|
| 945 |
-
mathematics, data science, and more. Built with marimo - the reactive
|
| 946 |
-
Python notebook that makes data exploration delightful.
|
| 947 |
-
</p>
|
| 948 |
-
<a href="#courses" class="eva-button">Explore Courses</a>
|
| 949 |
-
</section>"""
|
| 950 |
-
|
| 951 |
-
|
| 952 |
-
def get_html_features_section():
|
| 953 |
-
"""Generate the features section of the page."""
|
| 954 |
-
return """
|
| 955 |
-
<section id="features">
|
| 956 |
-
<h2 class="eva-section-title">Why Marimo Learn?</h2>
|
| 957 |
-
<div class="eva-features">
|
| 958 |
-
<div class="eva-feature">
|
| 959 |
-
<div class="eva-feature-icon"><i class="fas fa-bolt"></i></div>
|
| 960 |
-
<h3>Reactive Notebooks</h3>
|
| 961 |
-
<p>Experience the power of reactive programming with marimo notebooks that automatically update when dependencies change.</p>
|
| 962 |
-
</div>
|
| 963 |
-
<div class="eva-feature">
|
| 964 |
-
<div class="eva-feature-icon"><i class="fas fa-code"></i></div>
|
| 965 |
-
<h3>Learn by Doing</h3>
|
| 966 |
-
<p>Interactive examples and exercises help you understand concepts through hands-on practice.</p>
|
| 967 |
-
</div>
|
| 968 |
-
<div class="eva-feature">
|
| 969 |
-
<div class="eva-feature-icon"><i class="fas fa-graduation-cap"></i></div>
|
| 970 |
-
<h3>Comprehensive Courses</h3>
|
| 971 |
-
<p>From Python basics to advanced optimization techniques, our courses cover a wide range of topics.</p>
|
| 972 |
-
</div>
|
| 973 |
-
</div>
|
| 974 |
-
</section>"""
|
| 975 |
-
|
| 976 |
-
|
| 977 |
-
def get_html_courses_start():
|
| 978 |
-
"""Generate the beginning of the courses section."""
|
| 979 |
-
return """
|
| 980 |
-
<section id="courses">
|
| 981 |
-
<h2 class="eva-section-title">Explore Courses</h2>
|
| 982 |
-
<div class="eva-search">
|
| 983 |
-
<input type="text" id="courseSearch" placeholder="Search courses and notebooks...">
|
| 984 |
-
<span class="eva-search-icon"><i class="fas fa-search"></i></span>
|
| 985 |
-
</div>
|
| 986 |
-
<div class="eva-courses">"""
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
def generate_course_card(course, notebook_count, is_wip):
|
| 990 |
-
"""Generate HTML for a single course card."""
|
| 991 |
-
html = f'<div class="eva-course" data-course-id="{course["id"]}">\n'
|
| 992 |
-
|
| 993 |
-
# Add WIP badge if needed
|
| 994 |
-
if is_wip:
|
| 995 |
-
html += ' <div class="eva-course-badge"><i class="fas fa-code-branch"></i> In Progress</div>\n'
|
| 996 |
-
|
| 997 |
-
html += f''' <div class="eva-course-header">
|
| 998 |
-
<h2 class="eva-course-title">{course["title"]}</h2>
|
| 999 |
-
<span class="eva-course-toggle"><i class="fas fa-chevron-down"></i></span>
|
| 1000 |
-
</div>
|
| 1001 |
-
<div class="eva-course-front">
|
| 1002 |
-
<p class="eva-course-description">{course["description"]}</p>
|
| 1003 |
-
<div class="eva-course-stats">
|
| 1004 |
-
<span><i class="fas fa-book"></i> {notebook_count} notebook{"s" if notebook_count != 1 else ""}</span>
|
| 1005 |
-
</div>
|
| 1006 |
-
<button class="eva-button eva-course-button">View Notebooks</button>
|
| 1007 |
-
</div>
|
| 1008 |
-
<div class="eva-course-content">
|
| 1009 |
-
<div class="eva-notebooks">
|
| 1010 |
-
'''
|
| 1011 |
-
|
| 1012 |
-
# Add notebooks
|
| 1013 |
-
for i, notebook in enumerate(course["notebooks"]):
|
| 1014 |
-
notebook_number = notebook.get("original_number", f"{i+1:02d}")
|
| 1015 |
-
html += f''' <div class="eva-notebook">
|
| 1016 |
-
<span class="eva-notebook-number">{notebook_number}</span>
|
| 1017 |
-
<a href="{notebook["path"].replace(".py", ".html")}" data-notebook-title="{notebook["display_name"]}">{notebook["display_name"]}</a>
|
| 1018 |
-
</div>
|
| 1019 |
-
'''
|
| 1020 |
-
|
| 1021 |
-
html += ''' </div>
|
| 1022 |
-
</div>
|
| 1023 |
-
</div>
|
| 1024 |
-
'''
|
| 1025 |
-
return html
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
def generate_course_cards(courses):
|
| 1029 |
-
"""Generate HTML for all course cards."""
|
| 1030 |
-
html = ""
|
| 1031 |
-
|
| 1032 |
-
# Define the custom order for courses
|
| 1033 |
-
course_order = ["python", "probability", "polars", "optimization", "functional_programming"]
|
| 1034 |
-
|
| 1035 |
-
# Create a dictionary of courses by ID for easy lookup
|
| 1036 |
-
courses_by_id = {course["id"]: course for course in courses.values()}
|
| 1037 |
-
|
| 1038 |
-
# Determine which courses are "work in progress" based on description or notebook count
|
| 1039 |
-
work_in_progress = set()
|
| 1040 |
-
for course_id, course in courses_by_id.items():
|
| 1041 |
-
# Consider a course as "work in progress" if it has few notebooks or contains specific phrases
|
| 1042 |
-
if (len(course["notebooks"]) < 5 or
|
| 1043 |
-
"work in progress" in course["description"].lower() or
|
| 1044 |
-
"help us add" in course["description"].lower() or
|
| 1045 |
-
"check back later" in course["description"].lower()):
|
| 1046 |
-
work_in_progress.add(course_id)
|
| 1047 |
-
|
| 1048 |
-
# First output courses in the specified order
|
| 1049 |
-
for course_id in course_order:
|
| 1050 |
-
if course_id in courses_by_id:
|
| 1051 |
-
course = courses_by_id[course_id]
|
| 1052 |
-
|
| 1053 |
-
# Skip if no notebooks
|
| 1054 |
-
if not course["notebooks"]:
|
| 1055 |
-
continue
|
| 1056 |
-
|
| 1057 |
-
# Count notebooks
|
| 1058 |
-
notebook_count = len(course["notebooks"])
|
| 1059 |
-
|
| 1060 |
-
# Determine if this course is a work in progress
|
| 1061 |
-
is_wip = course_id in work_in_progress
|
| 1062 |
-
|
| 1063 |
-
html += generate_course_card(course, notebook_count, is_wip)
|
| 1064 |
-
|
| 1065 |
-
# Remove from the dictionary so we don't output it again
|
| 1066 |
-
del courses_by_id[course_id]
|
| 1067 |
-
|
| 1068 |
-
# Then output any remaining courses alphabetically
|
| 1069 |
-
sorted_remaining_courses = sorted(courses_by_id.values(), key=lambda x: x["title"])
|
| 1070 |
-
|
| 1071 |
-
for course in sorted_remaining_courses:
|
| 1072 |
-
# Skip if no notebooks
|
| 1073 |
-
if not course["notebooks"]:
|
| 1074 |
-
continue
|
| 1075 |
-
|
| 1076 |
-
# Count notebooks
|
| 1077 |
-
notebook_count = len(course["notebooks"])
|
| 1078 |
-
|
| 1079 |
-
# Determine if this course is a work in progress
|
| 1080 |
-
is_wip = course["id"] in work_in_progress
|
| 1081 |
-
|
| 1082 |
-
html += generate_course_card(course, notebook_count, is_wip)
|
| 1083 |
|
| 1084 |
-
return html
|
| 1085 |
-
|
| 1086 |
-
|
| 1087 |
-
def get_html_courses_end():
|
| 1088 |
-
"""Generate the end of the courses section."""
|
| 1089 |
-
return """ </div>
|
| 1090 |
-
</section>"""
|
| 1091 |
-
|
| 1092 |
-
|
| 1093 |
-
def get_html_contribute_section():
|
| 1094 |
-
"""Generate the contribute section."""
|
| 1095 |
-
return """
|
| 1096 |
-
<section id="contribute" class="eva-cta">
|
| 1097 |
-
<h2>Contribute to Marimo Learn</h2>
|
| 1098 |
-
<p>
|
| 1099 |
-
Help us expand our collection of educational notebooks. Whether you're an expert in machine learning,
|
| 1100 |
-
statistics, or any other field, your contributions are welcome!
|
| 1101 |
-
</p>
|
| 1102 |
-
<a href="https://github.com/marimo-team/learn" target="_blank" class="eva-button">
|
| 1103 |
-
<i class="fab fa-github"></i> Contribute on GitHub
|
| 1104 |
-
</a>
|
| 1105 |
-
</section>"""
|
| 1106 |
-
|
| 1107 |
-
|
| 1108 |
-
def get_html_footer():
|
| 1109 |
-
"""Generate the page footer."""
|
| 1110 |
-
return """
|
| 1111 |
-
<footer class="eva-footer">
|
| 1112 |
-
<div class="eva-footer-logo">
|
| 1113 |
-
<a href="https://marimo.io" target="_blank">
|
| 1114 |
-
<img src="https://marimo.io/logotype-wide.svg" alt="Marimo" width="200">
|
| 1115 |
-
</a>
|
| 1116 |
-
</div>
|
| 1117 |
-
<div class="eva-social-links">
|
| 1118 |
-
<a href="https://github.com/marimo-team" target="_blank" aria-label="GitHub"><i class="fab fa-github"></i></a>
|
| 1119 |
-
<a href="https://marimo.io/discord?ref=learn" target="_blank" aria-label="Discord"><i class="fab fa-discord"></i></a>
|
| 1120 |
-
<a href="https://twitter.com/marimo_io" target="_blank" aria-label="Twitter"><i class="fab fa-twitter"></i></a>
|
| 1121 |
-
<a href="https://www.youtube.com/@marimo-team" target="_blank" aria-label="YouTube"><i class="fab fa-youtube"></i></a>
|
| 1122 |
-
<a href="https://www.linkedin.com/company/marimo-io" target="_blank" aria-label="LinkedIn"><i class="fab fa-linkedin"></i></a>
|
| 1123 |
-
</div>
|
| 1124 |
-
<div class="eva-footer-links">
|
| 1125 |
-
<a href="https://marimo.io" target="_blank">Website</a>
|
| 1126 |
-
<a href="https://docs.marimo.io" target="_blank">Documentation</a>
|
| 1127 |
-
<a href="https://github.com/marimo-team/learn" target="_blank">GitHub</a>
|
| 1128 |
-
</div>
|
| 1129 |
-
<div class="eva-footer-copyright">
|
| 1130 |
-
© 2025 Marimo Inc. All rights reserved.
|
| 1131 |
-
</div>
|
| 1132 |
-
</footer>"""
|
| 1133 |
-
|
| 1134 |
-
|
| 1135 |
-
def get_html_scripts():
|
| 1136 |
-
"""Generate the JavaScript for the page."""
|
| 1137 |
-
return """
|
| 1138 |
-
<script>
|
| 1139 |
-
// Set light theme as default immediately
|
| 1140 |
-
document.documentElement.setAttribute('data-theme', 'light');
|
| 1141 |
-
|
| 1142 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 1143 |
-
// Theme toggle functionality
|
| 1144 |
-
const themeToggle = document.getElementById('themeToggle');
|
| 1145 |
-
const themeIcon = themeToggle.querySelector('i');
|
| 1146 |
-
|
| 1147 |
-
// Update theme icon based on current theme
|
| 1148 |
-
updateThemeIcon('light');
|
| 1149 |
-
|
| 1150 |
-
// Check localStorage for saved theme preference
|
| 1151 |
-
const savedTheme = localStorage.getItem('theme');
|
| 1152 |
-
if (savedTheme && savedTheme !== 'light') {
|
| 1153 |
-
document.documentElement.setAttribute('data-theme', savedTheme);
|
| 1154 |
-
updateThemeIcon(savedTheme);
|
| 1155 |
-
}
|
| 1156 |
-
|
| 1157 |
-
// Toggle theme when button is clicked
|
| 1158 |
-
themeToggle.addEventListener('click', () => {
|
| 1159 |
-
const currentTheme = document.documentElement.getAttribute('data-theme');
|
| 1160 |
-
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
|
| 1161 |
-
|
| 1162 |
-
document.documentElement.setAttribute('data-theme', newTheme);
|
| 1163 |
-
localStorage.setItem('theme', newTheme);
|
| 1164 |
-
updateThemeIcon(newTheme);
|
| 1165 |
-
});
|
| 1166 |
-
|
| 1167 |
-
function updateThemeIcon(theme) {
|
| 1168 |
-
if (theme === 'dark') {
|
| 1169 |
-
themeIcon.className = 'fas fa-sun';
|
| 1170 |
-
} else {
|
| 1171 |
-
themeIcon.className = 'fas fa-moon';
|
| 1172 |
-
}
|
| 1173 |
-
}
|
| 1174 |
-
|
| 1175 |
-
// Terminal typing effect for hero text
|
| 1176 |
-
const heroTitle = document.querySelector('.eva-hero h1');
|
| 1177 |
-
const heroText = document.querySelector('.eva-hero p');
|
| 1178 |
-
const cursor = document.querySelector('.eva-cursor');
|
| 1179 |
-
|
| 1180 |
-
const originalTitle = heroTitle.textContent;
|
| 1181 |
-
const originalText = heroText.textContent.trim();
|
| 1182 |
-
|
| 1183 |
-
heroTitle.textContent = '';
|
| 1184 |
-
heroText.textContent = '';
|
| 1185 |
-
|
| 1186 |
-
let titleIndex = 0;
|
| 1187 |
-
let textIndex = 0;
|
| 1188 |
-
|
| 1189 |
-
function typeTitle() {
|
| 1190 |
-
if (titleIndex < originalTitle.length) {
|
| 1191 |
-
heroTitle.textContent += originalTitle.charAt(titleIndex);
|
| 1192 |
-
titleIndex++;
|
| 1193 |
-
setTimeout(typeTitle, 50);
|
| 1194 |
-
} else {
|
| 1195 |
-
cursor.style.display = 'none';
|
| 1196 |
-
setTimeout(typeText, 500);
|
| 1197 |
-
}
|
| 1198 |
-
}
|
| 1199 |
-
|
| 1200 |
-
function typeText() {
|
| 1201 |
-
if (textIndex < originalText.length) {
|
| 1202 |
-
heroText.textContent += originalText.charAt(textIndex);
|
| 1203 |
-
textIndex++;
|
| 1204 |
-
setTimeout(typeText, 20);
|
| 1205 |
-
}
|
| 1206 |
-
}
|
| 1207 |
-
|
| 1208 |
-
typeTitle();
|
| 1209 |
-
|
| 1210 |
-
// Course toggle functionality - flashcard style
|
| 1211 |
-
const courseHeaders = document.querySelectorAll('.eva-course-header');
|
| 1212 |
-
const courseButtons = document.querySelectorAll('.eva-course-button');
|
| 1213 |
-
|
| 1214 |
-
// Function to toggle course
|
| 1215 |
-
function toggleCourse(course) {
|
| 1216 |
-
const isActive = course.classList.contains('active');
|
| 1217 |
-
|
| 1218 |
-
// First close all courses with a slight delay for better visual effect
|
| 1219 |
-
document.querySelectorAll('.eva-course.active').forEach(c => {
|
| 1220 |
-
if (c !== course) {
|
| 1221 |
-
// Add a closing class for animation
|
| 1222 |
-
c.classList.add('closing');
|
| 1223 |
-
// Remove active class after a short delay
|
| 1224 |
-
setTimeout(() => {
|
| 1225 |
-
c.classList.remove('active');
|
| 1226 |
-
c.classList.remove('closing');
|
| 1227 |
-
}, 300);
|
| 1228 |
-
}
|
| 1229 |
-
});
|
| 1230 |
-
|
| 1231 |
-
// Toggle the clicked course
|
| 1232 |
-
if (!isActive) {
|
| 1233 |
-
// Add a small delay before opening to allow others to close
|
| 1234 |
-
setTimeout(() => {
|
| 1235 |
-
course.classList.add('active');
|
| 1236 |
-
|
| 1237 |
-
// Check if the course has any notebooks
|
| 1238 |
-
const notebooks = course.querySelectorAll('.eva-notebook');
|
| 1239 |
-
const content = course.querySelector('.eva-course-content');
|
| 1240 |
-
|
| 1241 |
-
if (notebooks.length === 0 && !content.querySelector('.eva-empty-message')) {
|
| 1242 |
-
// If no notebooks, show a message
|
| 1243 |
-
const emptyMessage = document.createElement('p');
|
| 1244 |
-
emptyMessage.className = 'eva-empty-message';
|
| 1245 |
-
emptyMessage.textContent = 'No notebooks available in this course yet.';
|
| 1246 |
-
emptyMessage.style.color = 'var(--eva-text)';
|
| 1247 |
-
emptyMessage.style.fontStyle = 'italic';
|
| 1248 |
-
emptyMessage.style.opacity = '0.7';
|
| 1249 |
-
emptyMessage.style.textAlign = 'center';
|
| 1250 |
-
emptyMessage.style.padding = '1rem 0';
|
| 1251 |
-
content.appendChild(emptyMessage);
|
| 1252 |
-
}
|
| 1253 |
-
|
| 1254 |
-
// Animate notebooks to appear sequentially
|
| 1255 |
-
notebooks.forEach((notebook, index) => {
|
| 1256 |
-
notebook.style.opacity = '0';
|
| 1257 |
-
notebook.style.transform = 'translateX(-10px)';
|
| 1258 |
-
setTimeout(() => {
|
| 1259 |
-
notebook.style.opacity = '1';
|
| 1260 |
-
notebook.style.transform = 'translateX(0)';
|
| 1261 |
-
}, 50 + (index * 30)); // Stagger the animations
|
| 1262 |
-
});
|
| 1263 |
-
}, 100);
|
| 1264 |
-
}
|
| 1265 |
-
}
|
| 1266 |
-
|
| 1267 |
-
// Add click event to course headers
|
| 1268 |
-
courseHeaders.forEach(header => {
|
| 1269 |
-
header.addEventListener('click', function(e) {
|
| 1270 |
-
e.preventDefault();
|
| 1271 |
-
e.stopPropagation();
|
| 1272 |
-
|
| 1273 |
-
const currentCourse = this.closest('.eva-course');
|
| 1274 |
-
toggleCourse(currentCourse);
|
| 1275 |
-
});
|
| 1276 |
-
});
|
| 1277 |
-
|
| 1278 |
-
// Add click event to course buttons
|
| 1279 |
-
courseButtons.forEach(button => {
|
| 1280 |
-
button.addEventListener('click', function(e) {
|
| 1281 |
-
e.preventDefault();
|
| 1282 |
-
e.stopPropagation();
|
| 1283 |
-
|
| 1284 |
-
const currentCourse = this.closest('.eva-course');
|
| 1285 |
-
toggleCourse(currentCourse);
|
| 1286 |
-
});
|
| 1287 |
-
});
|
| 1288 |
-
|
| 1289 |
-
// Search functionality with improved matching
|
| 1290 |
-
const searchInput = document.getElementById('courseSearch');
|
| 1291 |
-
const courses = document.querySelectorAll('.eva-course');
|
| 1292 |
-
const notebooks = document.querySelectorAll('.eva-notebook');
|
| 1293 |
-
|
| 1294 |
-
searchInput.addEventListener('input', function() {
|
| 1295 |
-
const searchTerm = this.value.toLowerCase();
|
| 1296 |
-
|
| 1297 |
-
if (searchTerm === '') {
|
| 1298 |
-
// Reset all visibility
|
| 1299 |
-
courses.forEach(course => {
|
| 1300 |
-
course.style.display = 'block';
|
| 1301 |
-
course.classList.remove('active');
|
| 1302 |
-
});
|
| 1303 |
-
|
| 1304 |
-
notebooks.forEach(notebook => {
|
| 1305 |
-
notebook.style.display = 'flex';
|
| 1306 |
-
});
|
| 1307 |
-
|
| 1308 |
-
// Open the first course with notebooks by default when search is cleared
|
| 1309 |
-
for (let i = 0; i < courses.length; i++) {
|
| 1310 |
-
const courseNotebooks = courses[i].querySelectorAll('.eva-notebook');
|
| 1311 |
-
if (courseNotebooks.length > 0) {
|
| 1312 |
-
courses[i].classList.add('active');
|
| 1313 |
-
break;
|
| 1314 |
-
}
|
| 1315 |
-
}
|
| 1316 |
-
|
| 1317 |
-
return;
|
| 1318 |
-
}
|
| 1319 |
-
|
| 1320 |
-
// First hide all courses
|
| 1321 |
-
courses.forEach(course => {
|
| 1322 |
-
course.style.display = 'none';
|
| 1323 |
-
course.classList.remove('active');
|
| 1324 |
-
});
|
| 1325 |
-
|
| 1326 |
-
// Then show courses and notebooks that match the search
|
| 1327 |
-
let hasResults = false;
|
| 1328 |
-
|
| 1329 |
-
// Track which courses have matching notebooks
|
| 1330 |
-
const coursesWithMatchingNotebooks = new Set();
|
| 1331 |
-
|
| 1332 |
-
// First check notebooks
|
| 1333 |
-
notebooks.forEach(notebook => {
|
| 1334 |
-
const notebookTitle = notebook.querySelector('a').getAttribute('data-notebook-title').toLowerCase();
|
| 1335 |
-
const matchesSearch = notebookTitle.includes(searchTerm);
|
| 1336 |
-
|
| 1337 |
-
notebook.style.display = matchesSearch ? 'flex' : 'none';
|
| 1338 |
-
|
| 1339 |
-
if (matchesSearch) {
|
| 1340 |
-
const course = notebook.closest('.eva-course');
|
| 1341 |
-
coursesWithMatchingNotebooks.add(course.getAttribute('data-course-id'));
|
| 1342 |
-
hasResults = true;
|
| 1343 |
-
}
|
| 1344 |
-
});
|
| 1345 |
-
|
| 1346 |
-
// Then check course titles and descriptions
|
| 1347 |
-
courses.forEach(course => {
|
| 1348 |
-
const courseId = course.getAttribute('data-course-id');
|
| 1349 |
-
const courseTitle = course.querySelector('.eva-course-title').textContent.toLowerCase();
|
| 1350 |
-
const courseDescription = course.querySelector('.eva-course-description').textContent.toLowerCase();
|
| 1351 |
-
|
| 1352 |
-
const courseMatches = courseTitle.includes(searchTerm) || courseDescription.includes(searchTerm);
|
| 1353 |
-
|
| 1354 |
-
// Show course if it matches or has matching notebooks
|
| 1355 |
-
if (courseMatches || coursesWithMatchingNotebooks.has(courseId)) {
|
| 1356 |
-
course.style.display = 'block';
|
| 1357 |
-
course.classList.add('active');
|
| 1358 |
-
hasResults = true;
|
| 1359 |
-
|
| 1360 |
-
// If course matches but doesn't have matching notebooks, show all its notebooks
|
| 1361 |
-
if (courseMatches && !coursesWithMatchingNotebooks.has(courseId)) {
|
| 1362 |
-
course.querySelectorAll('.eva-notebook').forEach(nb => {
|
| 1363 |
-
nb.style.display = 'flex';
|
| 1364 |
-
});
|
| 1365 |
-
}
|
| 1366 |
-
}
|
| 1367 |
-
});
|
| 1368 |
-
});
|
| 1369 |
-
|
| 1370 |
-
// Open the first course with notebooks by default
|
| 1371 |
-
let firstCourseWithNotebooks = null;
|
| 1372 |
-
for (let i = 0; i < courses.length; i++) {
|
| 1373 |
-
const courseNotebooks = courses[i].querySelectorAll('.eva-notebook');
|
| 1374 |
-
if (courseNotebooks.length > 0) {
|
| 1375 |
-
firstCourseWithNotebooks = courses[i];
|
| 1376 |
-
break;
|
| 1377 |
-
}
|
| 1378 |
-
}
|
| 1379 |
-
|
| 1380 |
-
if (firstCourseWithNotebooks) {
|
| 1381 |
-
firstCourseWithNotebooks.classList.add('active');
|
| 1382 |
-
} else if (courses.length > 0) {
|
| 1383 |
-
// If no courses have notebooks, just open the first one
|
| 1384 |
-
courses[0].classList.add('active');
|
| 1385 |
-
}
|
| 1386 |
-
|
| 1387 |
-
// Smooth scrolling for anchor links
|
| 1388 |
-
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 1389 |
-
anchor.addEventListener('click', function(e) {
|
| 1390 |
-
e.preventDefault();
|
| 1391 |
-
|
| 1392 |
-
const targetId = this.getAttribute('href');
|
| 1393 |
-
const targetElement = document.querySelector(targetId);
|
| 1394 |
-
|
| 1395 |
-
if (targetElement) {
|
| 1396 |
-
window.scrollTo({
|
| 1397 |
-
top: targetElement.offsetTop - 100,
|
| 1398 |
-
behavior: 'smooth'
|
| 1399 |
-
});
|
| 1400 |
-
}
|
| 1401 |
-
});
|
| 1402 |
-
});
|
| 1403 |
-
});
|
| 1404 |
-
</script>"""
|
| 1405 |
-
|
| 1406 |
-
|
| 1407 |
-
def get_html_footer_closing():
|
| 1408 |
-
"""Generate closing HTML tags."""
|
| 1409 |
-
return """
|
| 1410 |
-
</div>
|
| 1411 |
-
</body>
|
| 1412 |
-
</html>"""
|
| 1413 |
-
|
| 1414 |
-
|
| 1415 |
-
def generate_index(courses: Dict[str, Dict[str, Any]], output_dir: str) -> None:
|
| 1416 |
-
"""Generate the index.html file with Neon Genesis Evangelion aesthetics."""
|
| 1417 |
-
print("Generating index.html")
|
| 1418 |
-
|
| 1419 |
index_path = os.path.join(output_dir, "index.html")
|
| 1420 |
os.makedirs(output_dir, exist_ok=True)
|
| 1421 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1422 |
try:
|
| 1423 |
with open(index_path, "w", encoding="utf-8") as f:
|
| 1424 |
-
#
|
| 1425 |
-
|
| 1426 |
-
|
| 1427 |
-
|
| 1428 |
-
|
| 1429 |
-
|
| 1430 |
-
courses_end = get_html_courses_end()
|
| 1431 |
-
contribute = get_html_contribute_section()
|
| 1432 |
-
footer = get_html_footer()
|
| 1433 |
-
scripts = get_html_scripts()
|
| 1434 |
-
closing = get_html_footer_closing()
|
| 1435 |
|
| 1436 |
-
|
| 1437 |
-
f.write(header)
|
| 1438 |
-
f.write(hero)
|
| 1439 |
-
f.write(features)
|
| 1440 |
-
f.write(courses_start)
|
| 1441 |
-
f.write(course_cards)
|
| 1442 |
-
f.write(courses_end)
|
| 1443 |
-
f.write(contribute)
|
| 1444 |
-
f.write(footer)
|
| 1445 |
-
f.write(scripts)
|
| 1446 |
-
f.write(closing)
|
| 1447 |
|
| 1448 |
except IOError as e:
|
| 1449 |
-
print(f"Error generating
|
| 1450 |
|
| 1451 |
|
| 1452 |
def main() -> None:
|
|
@@ -1507,8 +259,8 @@ def main() -> None:
|
|
| 1507 |
# Organize notebooks by course (only include successfully exported notebooks)
|
| 1508 |
courses = organize_notebooks_by_course(successful_notebooks)
|
| 1509 |
|
| 1510 |
-
# Generate
|
| 1511 |
-
|
| 1512 |
|
| 1513 |
# Save course data as JSON for potential use by other tools
|
| 1514 |
courses_json_path = os.path.join(args.output_dir, "courses.json")
|
|
|
|
| 4 |
import subprocess
|
| 5 |
import argparse
|
| 6 |
import json
|
| 7 |
+
import datetime
|
| 8 |
+
from datetime import date
|
| 9 |
from pathlib import Path
|
| 10 |
+
from typing import Dict, List, Any, Optional, Tuple
|
| 11 |
+
|
| 12 |
+
from jinja2 import Environment, FileSystemLoader
|
| 13 |
|
| 14 |
|
| 15 |
def export_html_wasm(notebook_path: str, output_dir: str, as_app: bool = False) -> bool:
|
| 16 |
"""Export a single marimo notebook to HTML format.
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
notebook_path: Path to the notebook to export
|
| 20 |
+
output_dir: Directory to write the output HTML files
|
| 21 |
+
as_app: If True, export as app instead of notebook
|
| 22 |
+
|
| 23 |
Returns:
|
| 24 |
bool: True if export succeeded, False otherwise
|
| 25 |
"""
|
| 26 |
+
# Create directory for the output
|
| 27 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 28 |
+
|
| 29 |
+
# Determine the output path (preserving directory structure)
|
| 30 |
+
rel_path = os.path.basename(os.path.dirname(notebook_path))
|
| 31 |
+
if rel_path != os.path.dirname(notebook_path):
|
| 32 |
+
# Create subdirectory if needed
|
| 33 |
+
os.makedirs(os.path.join(output_dir, rel_path), exist_ok=True)
|
| 34 |
+
|
| 35 |
+
# Determine output filename (same as input but with .html extension)
|
| 36 |
+
output_filename = os.path.basename(notebook_path).replace(".py", ".html")
|
| 37 |
+
output_path = os.path.join(output_dir, rel_path, output_filename)
|
| 38 |
+
|
| 39 |
+
# Run marimo export command
|
| 40 |
+
mode = "--mode app" if as_app else "--mode edit"
|
| 41 |
+
cmd = f"marimo export html-wasm {mode} {notebook_path} -o {output_path} --sandbox"
|
| 42 |
+
print(f"Exporting {notebook_path} to {rel_path}/{output_filename} as {'app' if as_app else 'notebook'}")
|
| 43 |
+
print(f"Running command: {cmd}")
|
| 44 |
+
|
| 45 |
try:
|
| 46 |
+
result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True)
|
| 47 |
+
print(f"Successfully exported {notebook_path} to {output_path}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
return True
|
|
|
|
|
|
|
|
|
|
| 49 |
except subprocess.CalledProcessError as e:
|
| 50 |
+
print(f"Error exporting {notebook_path}: {e}")
|
| 51 |
+
print(f"Command output: {e.output}")
|
|
|
|
|
|
|
|
|
|
| 52 |
return False
|
| 53 |
|
| 54 |
|
| 55 |
def get_course_metadata(course_dir: Path) -> Dict[str, Any]:
|
| 56 |
+
"""Extract metadata from a course directory.
|
| 57 |
+
|
| 58 |
+
Reads the README.md file to extract title and description.
|
| 59 |
+
|
| 60 |
+
Args:
|
| 61 |
+
course_dir: Path to the course directory
|
|
|
|
| 62 |
|
| 63 |
+
Returns:
|
| 64 |
+
Dict: Dictionary containing course metadata (title, description)
|
| 65 |
+
"""
|
| 66 |
readme_path = course_dir / "README.md"
|
| 67 |
+
title = course_dir.name.replace("_", " ").title()
|
| 68 |
+
description = ""
|
| 69 |
+
|
| 70 |
if readme_path.exists():
|
| 71 |
with open(readme_path, "r", encoding="utf-8") as f:
|
| 72 |
content = f.read()
|
| 73 |
+
|
| 74 |
+
# Try to extract title from first heading
|
| 75 |
+
title_match = content.split("\n")[0]
|
| 76 |
+
if title_match.startswith("# "):
|
| 77 |
+
title = title_match[2:].strip()
|
| 78 |
+
|
| 79 |
+
# Extract description from content after first heading
|
| 80 |
+
desc_content = "\n".join(content.split("\n")[1:]).strip()
|
| 81 |
+
if desc_content:
|
| 82 |
+
# Take first paragraph as description
|
| 83 |
+
description = desc_content.split("\n\n")[0].replace("\n", " ").strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
+
return {
|
| 86 |
+
"title": title,
|
| 87 |
+
"description": description
|
| 88 |
+
}
|
| 89 |
|
| 90 |
|
| 91 |
def organize_notebooks_by_course(all_notebooks: List[str]) -> Dict[str, Dict[str, Any]]:
|
| 92 |
+
"""Organize notebooks by course.
|
| 93 |
+
|
| 94 |
+
Args:
|
| 95 |
+
all_notebooks: List of paths to notebooks
|
| 96 |
+
|
| 97 |
+
Returns:
|
| 98 |
+
Dict: A dictionary where keys are course directories and values are
|
| 99 |
+
metadata about the course and its notebooks
|
| 100 |
+
"""
|
| 101 |
courses = {}
|
| 102 |
|
| 103 |
+
for notebook_path in sorted(all_notebooks):
|
| 104 |
+
# Parse the path to determine course
|
| 105 |
+
# The first directory in the path is the course
|
| 106 |
+
path_parts = Path(notebook_path).parts
|
| 107 |
|
| 108 |
+
if len(path_parts) < 2:
|
| 109 |
+
print(f"Skipping notebook with invalid path: {notebook_path}")
|
| 110 |
+
continue
|
| 111 |
+
|
| 112 |
+
course_id = path_parts[0]
|
| 113 |
|
| 114 |
+
# If this is a new course, initialize it
|
| 115 |
+
if course_id not in courses:
|
| 116 |
+
course_metadata = get_course_metadata(Path(course_id))
|
| 117 |
+
|
| 118 |
+
courses[course_id] = {
|
| 119 |
+
"id": course_id,
|
| 120 |
+
"title": course_metadata["title"],
|
| 121 |
+
"description": course_metadata["description"],
|
| 122 |
+
"notebooks": []
|
| 123 |
+
}
|
| 124 |
|
| 125 |
+
# Extract the notebook number and name from the filename
|
| 126 |
+
filename = Path(notebook_path).name
|
| 127 |
+
basename = filename.replace(".py", "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
+
# Extract notebook metadata
|
| 130 |
+
notebook_title = basename.replace("_", " ").title()
|
|
|
|
|
|
|
| 131 |
|
| 132 |
+
# Try to extract a sequence number from the start of the filename
|
| 133 |
+
# Match patterns like: 01_xxx, 1_xxx, etc.
|
| 134 |
+
import re
|
| 135 |
+
number_match = re.match(r'^(\d+)(?:[_-]|$)', basename)
|
| 136 |
+
notebook_number = number_match.group(1) if number_match else None
|
| 137 |
|
| 138 |
+
# If we found a number, remove it from the title
|
| 139 |
+
if number_match:
|
| 140 |
+
notebook_title = re.sub(r'^\d+\s*[_-]?\s*', '', notebook_title)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
# Calculate the HTML output path (for linking)
|
| 143 |
+
html_path = f"{course_id}/{filename.replace('.py', '.html')}"
|
| 144 |
|
| 145 |
+
# Add the notebook to the course
|
| 146 |
courses[course_id]["notebooks"].append({
|
|
|
|
| 147 |
"path": notebook_path,
|
| 148 |
+
"html_path": html_path,
|
| 149 |
+
"title": notebook_title,
|
| 150 |
+
"display_name": notebook_title,
|
| 151 |
+
"original_number": notebook_number
|
| 152 |
})
|
| 153 |
|
| 154 |
+
# Sort notebooks by number if available, otherwise by title
|
| 155 |
+
for course_id, course_data in courses.items():
|
| 156 |
+
# Sort the notebooks list by number and title
|
| 157 |
+
course_data["notebooks"] = sorted(
|
| 158 |
+
course_data["notebooks"],
|
| 159 |
+
key=lambda x: (
|
| 160 |
+
int(x["original_number"]) if x["original_number"] is not None else float('inf'),
|
| 161 |
+
x["title"]
|
| 162 |
+
)
|
| 163 |
+
)
|
| 164 |
|
| 165 |
return courses
|
| 166 |
|
| 167 |
|
| 168 |
+
def generate_clean_tailwind_landing_page(courses: Dict[str, Dict[str, Any]], output_dir: str) -> None:
|
| 169 |
+
"""Generate a clean tailwindcss landing page with green accents.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
+
This generates a modern, minimal landing page for marimo notebooks using tailwindcss.
|
| 172 |
+
The page is designed with clean aesthetics and green color accents using Jinja2 templates.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
+
Args:
|
| 175 |
+
courses: Dictionary of courses metadata
|
| 176 |
+
output_dir: Directory to write the output index.html file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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inja2 template
|
| 184 |
+
current_dir = Path(__file__).parent
|
| 185 |
+
templates_dir = current_dir / "templates"
|
| 186 |
+
env = Environment(loader=FileSystemLoader(templates_dir))
|
| 187 |
+
template = env.get_template('index.html')
|
| 188 |
+
|
| 189 |
try:
|
| 190 |
with open(index_path, "w", encoding="utf-8") as f:
|
| 191 |
+
# Render the template with the provided data
|
| 192 |
+
rendered_html = template.render(
|
| 193 |
+
courses=courses,
|
| 194 |
+
current_year=datetime.date.today().year
|
| 195 |
+
)
|
| 196 |
+
f.write(rendered_html)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
print(f"Successfully generated clean tailwindcss landing page at {index_path}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
except IOError as e:
|
| 201 |
+
print(f"Error generating clean tailwindcss landing page: {e}")
|
| 202 |
|
| 203 |
|
| 204 |
def main() -> None:
|
|
|
|
| 259 |
# Organize notebooks by course (only include successfully exported notebooks)
|
| 260 |
courses = organize_notebooks_by_course(successful_notebooks)
|
| 261 |
|
| 262 |
+
# Generate landing page using Tailwind CSS
|
| 263 |
+
generate_clean_tailwind_landing_page(courses, args.output_dir)
|
| 264 |
|
| 265 |
# Save course data as JSON for potential use by other tools
|
| 266 |
courses_json_path = os.path.join(args.output_dir, "courses.json")
|
scripts/templates/index.html
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Marimo Learn - Interactive Python Notebooks</title>
|
| 7 |
+
<meta name="description" content="Learn Python, data science, and machine learning with interactive marimo notebooks">
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--primary-green: #10B981;
|
| 12 |
+
--dark-green: #047857;
|
| 13 |
+
--light-green: #D1FAE5;
|
| 14 |
+
}
|
| 15 |
+
.bg-primary { background-color: var(--primary-green); }
|
| 16 |
+
.text-primary { color: var(--primary-green); }
|
| 17 |
+
.border-primary { border-color: var(--primary-green); }
|
| 18 |
+
.bg-light { background-color: var(--light-green); }
|
| 19 |
+
.hover-grow { transition: transform 0.2s ease; }
|
| 20 |
+
.hover-grow:hover { transform: scale(1.02); }
|
| 21 |
+
.card-shadow { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1); }
|
| 22 |
+
</style>
|
| 23 |
+
</head>
|
| 24 |
+
<body class="bg-gray-50 text-gray-800 font-sans">
|
| 25 |
+
<!-- Hero Section -->
|
| 26 |
+
<header class="bg-white">
|
| 27 |
+
<div class="container mx-auto px-4 py-12 max-w-6xl">
|
| 28 |
+
<div class="flex flex-col md:flex-row items-center justify-between">
|
| 29 |
+
<div class="md:w-1/2 mb-8 md:mb-0 md:pr-12">
|
| 30 |
+
<h1 class="text-4xl md:text-5xl font-bold mb-4">Interactive Python Learning with <span class="text-primary">Marimo</span></h1>
|
| 31 |
+
<p class="text-lg text-gray-600 mb-6">Explore our collection of interactive notebooks for Python, data science, and machine learning.</p>
|
| 32 |
+
<div class="flex flex-wrap gap-4">
|
| 33 |
+
<a href="#courses" class="bg-primary hover:bg-dark-green text-white font-medium py-2 px-6 rounded-md transition duration-300">Explore Courses</a>
|
| 34 |
+
<a href="https://github.com/marimo-team/learn" target="_blank" class="bg-white border border-gray-300 hover:border-primary text-gray-700 font-medium py-2 px-6 rounded-md transition duration-300">View on GitHub</a>
|
| 35 |
+
</div>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="md:w-1/2">
|
| 38 |
+
<div class="bg-light p-1 rounded-lg">
|
| 39 |
+
<img src="https://marimo.io/logo-glow.png" alt="Marimo Logo" class="w-64 h-64 mx-auto object-contain">
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
</header>
|
| 45 |
+
|
| 46 |
+
<!-- Features Section -->
|
| 47 |
+
<section class="py-16 bg-gray-50">
|
| 48 |
+
<div class="container mx-auto px-4 max-w-6xl">
|
| 49 |
+
<h2 class="text-3xl font-bold text-center mb-12">Why Learn with <span class="text-primary">Marimo</span>?</h2>
|
| 50 |
+
<div class="grid md:grid-cols-3 gap-8">
|
| 51 |
+
<div class="bg-white p-6 rounded-lg card-shadow">
|
| 52 |
+
<div class="w-12 h-12 bg-light rounded-full flex items-center justify-center mb-4">
|
| 53 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 54 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
| 55 |
+
</svg>
|
| 56 |
+
</div>
|
| 57 |
+
<h3 class="text-xl font-semibold mb-2">Interactive Learning</h3>
|
| 58 |
+
<p class="text-gray-600">Learn by doing with interactive notebooks that run directly in your browser.</p>
|
| 59 |
+
</div>
|
| 60 |
+
<div class="bg-white p-6 rounded-lg card-shadow">
|
| 61 |
+
<div class="w-12 h-12 bg-light rounded-full flex items-center justify-center mb-4">
|
| 62 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 63 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z" />
|
| 64 |
+
</svg>
|
| 65 |
+
</div>
|
| 66 |
+
<h3 class="text-xl font-semibold mb-2">Practical Examples</h3>
|
| 67 |
+
<p class="text-gray-600">Real-world examples and applications to reinforce your understanding.</p>
|
| 68 |
+
</div>
|
| 69 |
+
<div class="bg-white p-6 rounded-lg card-shadow">
|
| 70 |
+
<div class="w-12 h-12 bg-light rounded-full flex items-center justify-center mb-4">
|
| 71 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 72 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />
|
| 73 |
+
</svg>
|
| 74 |
+
</div>
|
| 75 |
+
<h3 class="text-xl font-semibold mb-2">Comprehensive Curriculum</h3>
|
| 76 |
+
<p class="text-gray-600">From Python basics to advanced machine learning concepts.</p>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
</div>
|
| 80 |
+
</section>
|
| 81 |
+
|
| 82 |
+
<!-- Courses Section -->
|
| 83 |
+
<section id="courses" class="py-16 bg-white">
|
| 84 |
+
<div class="container mx-auto px-4 max-w-6xl">
|
| 85 |
+
<h2 class="text-3xl font-bold text-center mb-12">Explore Our <span class="text-primary">Courses</span></h2>
|
| 86 |
+
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 87 |
+
{% for course_id, course in courses.items() %}
|
| 88 |
+
{% set notebooks = course.get('notebooks', []) %}
|
| 89 |
+
{% set notebook_count = notebooks|length %}
|
| 90 |
+
|
| 91 |
+
{% if notebook_count > 0 %}
|
| 92 |
+
{% set title = course.get('title', course_id|replace('_', ' ')|title) %}
|
| 93 |
+
{% set description = course.get('description', '') %}
|
| 94 |
+
{% if description|length > 120 %}
|
| 95 |
+
{% set description = description[:117] + '...' %}
|
| 96 |
+
{% endif %}
|
| 97 |
+
|
| 98 |
+
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden hover-grow card-shadow">
|
| 99 |
+
<div class="h-2 bg-primary"></div>
|
| 100 |
+
<div class="p-6">
|
| 101 |
+
<h3 class="text-xl font-semibold mb-2">{{ title }}</h3>
|
| 102 |
+
<p class="text-gray-600 mb-4 h-20 overflow-hidden">{{ description }}</p>
|
| 103 |
+
<div class="mb-4">
|
| 104 |
+
<span class="text-sm text-gray-500 block mb-2">{{ notebook_count }} notebooks:</span>
|
| 105 |
+
<ul class="space-y-1 max-h-40 overflow-y-auto pr-2">
|
| 106 |
+
{% for notebook in notebooks %}
|
| 107 |
+
{% set notebook_title = notebook.get('title', notebook.get('path', '').split('/')[-1].replace('.py', '').replace('_', ' ').title()) %}
|
| 108 |
+
<li>
|
| 109 |
+
<a href="{{ notebook.get('html_path', '#') }}" class="text-primary hover:text-dark-green text-sm flex items-center">
|
| 110 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-3 w-3 mr-1 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 111 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
| 112 |
+
</svg>
|
| 113 |
+
{{ notebook_title }}
|
| 114 |
+
</a>
|
| 115 |
+
</li>
|
| 116 |
+
{% endfor %}
|
| 117 |
+
</ul>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
{% endif %}
|
| 122 |
+
{% endfor %}
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
</section>
|
| 126 |
+
|
| 127 |
+
<!-- Contribute Section -->
|
| 128 |
+
<section class="py-16 bg-light">
|
| 129 |
+
<div class="container mx-auto px-4 max-w-6xl text-center">
|
| 130 |
+
<h2 class="text-3xl font-bold mb-6">Want to Contribute?</h2>
|
| 131 |
+
<p class="text-lg text-gray-700 mb-8 max-w-2xl mx-auto">Help us improve these learning materials by contributing to the GitHub repository. We welcome new content, bug fixes, and improvements!</p>
|
| 132 |
+
<a href="https://github.com/marimo-team/learn" target="_blank" class="bg-primary hover:bg-dark-green text-white font-medium py-3 px-8 rounded-md transition duration-300 inline-flex items-center">
|
| 133 |
+
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
| 134 |
+
<path fill-rule="evenodd" d="M10 0C4.477 0 0 4.477 0 10c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.87 1.52 2.34 1.07 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71-.1-.25-.45-1.29.1-2.64 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" clip-rule="evenodd"></path>
|
| 135 |
+
</svg>
|
| 136 |
+
Contribute on GitHub
|
| 137 |
+
</a>
|
| 138 |
+
</div>
|
| 139 |
+
</section>
|
| 140 |
+
|
| 141 |
+
<!-- Footer -->
|
| 142 |
+
<footer class="bg-gray-800 text-white py-8">
|
| 143 |
+
<div class="container mx-auto px-4 max-w-6xl">
|
| 144 |
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
| 145 |
+
<div class="mb-4 md:mb-0">
|
| 146 |
+
<p>© {{ current_year }} Marimo Learn. All rights reserved.</p>
|
| 147 |
+
</div>
|
| 148 |
+
<div class="flex space-x-4">
|
| 149 |
+
<a href="https://github.com/marimo-team/learn" target="_blank" class="text-gray-300 hover:text-white transition duration-300">
|
| 150 |
+
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
| 151 |
+
<path fill-rule="evenodd" d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" clip-rule="evenodd"></path>
|
| 152 |
+
</svg>
|
| 153 |
+
</a>
|
| 154 |
+
<a href="https://marimo.io" target="_blank" class="text-gray-300 hover:text-white transition duration-300">
|
| 155 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 156 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
|
| 157 |
+
</svg>
|
| 158 |
+
</a>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
</div>
|
| 162 |
+
</footer>
|
| 163 |
+
|
| 164 |
+
<!-- Scripts -->
|
| 165 |
+
<script>
|
| 166 |
+
// Smooth scrolling for anchor links
|
| 167 |
+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 168 |
+
anchor.addEventListener('click', function (e) {
|
| 169 |
+
e.preventDefault();
|
| 170 |
+
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
| 171 |
+
behavior: 'smooth'
|
| 172 |
+
});
|
| 173 |
+
});
|
| 174 |
+
});
|
| 175 |
+
</script>
|
| 176 |
+
</body>
|
| 177 |
+
</html>
|
scripts/templates/tailwind_base.html
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Marimo Learn - Interactive Python Notebooks</title>
|
| 7 |
+
<meta name="description" content="Learn Python, data science, and machine learning with interactive marimo notebooks">
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--primary-green: #10B981;
|
| 12 |
+
--dark-green: #047857;
|
| 13 |
+
--light-green: #D1FAE5;
|
| 14 |
+
}
|
| 15 |
+
.bg-primary { background-color: var(--primary-green); }
|
| 16 |
+
.text-primary { color: var(--primary-green); }
|
| 17 |
+
.border-primary { border-color: var(--primary-green); }
|
| 18 |
+
.bg-light { background-color: var(--light-green); }
|
| 19 |
+
.hover-grow { transition: transform 0.2s ease; }
|
| 20 |
+
.hover-grow:hover { transform: scale(1.02); }
|
| 21 |
+
.card-shadow { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1); }
|
| 22 |
+
</style>
|
| 23 |
+
</head>
|
| 24 |
+
<body class="bg-gray-50 text-gray-800 font-sans">
|
| 25 |
+
<!-- Hero Section -->
|
| 26 |
+
{% include 'tailwind_hero.html' %}
|
| 27 |
+
|
| 28 |
+
<!-- Features Section -->
|
| 29 |
+
{% include 'tailwind_features.html' %}
|
| 30 |
+
|
| 31 |
+
<!-- Courses Section -->
|
| 32 |
+
{% include 'tailwind_courses.html' %}
|
| 33 |
+
|
| 34 |
+
<!-- Contribute Section -->
|
| 35 |
+
{% include 'tailwind_contribute.html' %}
|
| 36 |
+
|
| 37 |
+
<!-- Footer -->
|
| 38 |
+
{% include 'tailwind_footer.html' %}
|
| 39 |
+
|
| 40 |
+
<!-- Scripts -->
|
| 41 |
+
<script>
|
| 42 |
+
// Smooth scrolling for anchor links
|
| 43 |
+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 44 |
+
anchor.addEventListener('click', function (e) {
|
| 45 |
+
e.preventDefault();
|
| 46 |
+
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
| 47 |
+
behavior: 'smooth'
|
| 48 |
+
});
|
| 49 |
+
});
|
| 50 |
+
});
|
| 51 |
+
</script>
|
| 52 |
+
</body>
|
| 53 |
+
</html>
|
scripts/templates/tailwind_contribute.html
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<section class="py-16 bg-light">
|
| 2 |
+
<div class="container mx-auto px-4 max-w-6xl text-center">
|
| 3 |
+
<h2 class="text-3xl font-bold mb-6">Want to Contribute?</h2>
|
| 4 |
+
<p class="text-lg text-gray-700 mb-8 max-w-2xl mx-auto">Help us improve these learning materials by contributing to the GitHub repository. We welcome new content, bug fixes, and improvements!</p>
|
| 5 |
+
<a href="https://github.com/marimo-team/learn" target="_blank" class="bg-primary hover:bg-dark-green text-white font-medium py-3 px-8 rounded-md transition duration-300 inline-flex items-center">
|
| 6 |
+
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
| 7 |
+
<path fill-rule="evenodd" d="M10 0C4.477 0 0 4.477 0 10c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.87 1.52 2.34 1.07 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71-.1-.25-.45-1.29.1-2.64 0 0 .84-.27 2.75 1.02.79-.22 1.65-.33 2.5-.33.85 0 1.71.11 2.5.33 1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.39.1 2.64.65.71 1.03 1.6 1.03 2.71 0 3.82-2.34 4.66-4.57 4.91.36.31.69.92.69 1.85V19c0 .27.16.59.67.5C17.14 18.16 20 14.42 20 10A10 10 0 0010 0z" clip-rule="evenodd"></path>
|
| 8 |
+
</svg>
|
| 9 |
+
Contribute on GitHub
|
| 10 |
+
</a>
|
| 11 |
+
</div>
|
| 12 |
+
</section>
|
scripts/templates/tailwind_courses.html
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<section id="courses" class="py-16 bg-white">
|
| 2 |
+
<div class="container mx-auto px-4 max-w-6xl">
|
| 3 |
+
<h2 class="text-3xl font-bold text-center mb-12">Explore Our <span class="text-primary">Courses</span></h2>
|
| 4 |
+
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 5 |
+
{% for course_id, course in courses.items() %}
|
| 6 |
+
{% set notebooks = course.get('notebooks', []) %}
|
| 7 |
+
{% set notebook_count = notebooks|length %}
|
| 8 |
+
|
| 9 |
+
{% if notebook_count > 0 %}
|
| 10 |
+
{% set title = course.get('title', course_id|replace('_', ' ')|title) %}
|
| 11 |
+
{% set description = course.get('description', '') %}
|
| 12 |
+
{% if description|length > 120 %}
|
| 13 |
+
{% set description = description[:117] + '...' %}
|
| 14 |
+
{% endif %}
|
| 15 |
+
|
| 16 |
+
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden hover-grow card-shadow">
|
| 17 |
+
<div class="h-2 bg-primary"></div>
|
| 18 |
+
<div class="p-6">
|
| 19 |
+
<h3 class="text-xl font-semibold mb-2">{{ title }}</h3>
|
| 20 |
+
<p class="text-gray-600 mb-4 h-20 overflow-hidden">{{ description }}</p>
|
| 21 |
+
<div class="flex justify-between items-center">
|
| 22 |
+
<span class="text-sm text-gray-500">{{ notebook_count }} notebooks</span>
|
| 23 |
+
<a href="{{ course_id }}/index.html" class="text-primary hover:text-dark-green font-medium inline-flex items-center">
|
| 24 |
+
Explore
|
| 25 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 26 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
| 27 |
+
</svg>
|
| 28 |
+
</a>
|
| 29 |
+
</div>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
{% endif %}
|
| 33 |
+
{% endfor %}
|
| 34 |
+
</div>
|
| 35 |
+
</div>
|
| 36 |
+
</section>
|
scripts/templates/tailwind_features.html
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<section class="py-16 bg-gray-50">
|
| 2 |
+
<div class="container mx-auto px-4 max-w-6xl">
|
| 3 |
+
<h2 class="text-3xl font-bold text-center mb-12">Why Learn with <span class="text-primary">Marimo</span>?</h2>
|
| 4 |
+
<div class="grid md:grid-cols-3 gap-8">
|
| 5 |
+
<div class="bg-white p-6 rounded-lg card-shadow">
|
| 6 |
+
<div class="w-12 h-12 bg-light rounded-full flex items-center justify-center mb-4">
|
| 7 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 8 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
| 9 |
+
</svg>
|
| 10 |
+
</div>
|
| 11 |
+
<h3 class="text-xl font-semibold mb-2">Interactive Learning</h3>
|
| 12 |
+
<p class="text-gray-600">Learn by doing with interactive notebooks that run directly in your browser.</p>
|
| 13 |
+
</div>
|
| 14 |
+
<div class="bg-white p-6 rounded-lg card-shadow">
|
| 15 |
+
<div class="w-12 h-12 bg-light rounded-full flex items-center justify-center mb-4">
|
| 16 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 17 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z" />
|
| 18 |
+
</svg>
|
| 19 |
+
</div>
|
| 20 |
+
<h3 class="text-xl font-semibold mb-2">Practical Examples</h3>
|
| 21 |
+
<p class="text-gray-600">Real-world examples and applications to reinforce your understanding.</p>
|
| 22 |
+
</div>
|
| 23 |
+
<div class="bg-white p-6 rounded-lg card-shadow">
|
| 24 |
+
<div class="w-12 h-12 bg-light rounded-full flex items-center justify-center mb-4">
|
| 25 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-primary" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 26 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />
|
| 27 |
+
</svg>
|
| 28 |
+
</div>
|
| 29 |
+
<h3 class="text-xl font-semibold mb-2">Comprehensive Curriculum</h3>
|
| 30 |
+
<p class="text-gray-600">From Python basics to advanced machine learning concepts.</p>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
</div>
|
| 34 |
+
</section>
|
scripts/templates/tailwind_footer.html
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<footer class="bg-gray-800 text-white py-8">
|
| 2 |
+
<div class="container mx-auto px-4 max-w-6xl">
|
| 3 |
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
| 4 |
+
<div class="mb-4 md:mb-0">
|
| 5 |
+
<p>© {{ current_year }} Marimo Learn. All rights reserved.</p>
|
| 6 |
+
</div>
|
| 7 |
+
<div class="flex space-x-4">
|
| 8 |
+
<a href="https://github.com/marimo-team/learn" target="_blank" class="text-gray-300 hover:text-white transition duration-300">
|
| 9 |
+
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
| 10 |
+
<path fill-rule="evenodd" d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" clip-rule="evenodd"></path>
|
| 11 |
+
</svg>
|
| 12 |
+
</a>
|
| 13 |
+
<a href="https://marimo.io" target="_blank" class="text-gray-300 hover:text-white transition duration-300">
|
| 14 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 15 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9" />
|
| 16 |
+
</svg>
|
| 17 |
+
</a>
|
| 18 |
+
</div>
|
| 19 |
+
</div>
|
| 20 |
+
</div>
|
| 21 |
+
</footer>
|
scripts/templates/tailwind_hero.html
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<header class="bg-white">
|
| 2 |
+
<div class="container mx-auto px-4 py-12 max-w-6xl">
|
| 3 |
+
<div class="flex flex-col md:flex-row items-center justify-between">
|
| 4 |
+
<div class="md:w-1/2 mb-8 md:mb-0 md:pr-12">
|
| 5 |
+
<h1 class="text-4xl md:text-5xl font-bold mb-4">Interactive Python Learning with <span class="text-primary">Marimo</span></h1>
|
| 6 |
+
<p class="text-lg text-gray-600 mb-6">Explore our collection of interactive notebooks for Python, data science, and machine learning.</p>
|
| 7 |
+
<div class="flex flex-wrap gap-4">
|
| 8 |
+
<a href="#courses" class="bg-primary hover:bg-dark-green text-white font-medium py-2 px-6 rounded-md transition duration-300">Explore Courses</a>
|
| 9 |
+
<a href="https://github.com/marimo-team/learn" target="_blank" class="bg-white border border-gray-300 hover:border-primary text-gray-700 font-medium py-2 px-6 rounded-md transition duration-300">View on GitHub</a>
|
| 10 |
+
</div>
|
| 11 |
+
</div>
|
| 12 |
+
<div class="md:w-1/2">
|
| 13 |
+
<div class="bg-light p-1 rounded-lg">
|
| 14 |
+
<img src="https://marimo.io/logo-glow.png" alt="Marimo Logo" class="w-64 h-64 mx-auto object-contain">
|
| 15 |
+
</div>
|
| 16 |
+
</div>
|
| 17 |
+
</div>
|
| 18 |
+
</div>
|
| 19 |
+
</header>
|