Vincent Warmerdam commited on
Commit
a7e66b2
·
1 Parent(s): 77b9c0b
Makefile CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  build:
2
  rm -rf _site
3
  uv run scripts/build.py
 
1
+ install:
2
+ uv pip install marimo jinja2 markdown
3
+
4
  build:
5
  rm -rf _site
6
  uv run scripts/build.py
scripts/build.py CHANGED
@@ -5,6 +5,7 @@ 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
@@ -66,6 +67,7 @@ def get_course_metadata(course_dir: Path) -> Dict[str, Any]:
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:
@@ -79,12 +81,15 @@ def get_course_metadata(course_dir: Path) -> Dict[str, Any]:
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
 
@@ -119,6 +124,7 @@ def organize_notebooks_by_course(all_notebooks: List[str]) -> Dict[str, Dict[str
119
  "id": course_id,
120
  "title": course_metadata["title"],
121
  "description": course_metadata["description"],
 
122
  "notebooks": []
123
  }
124
 
 
5
  import argparse
6
  import json
7
  import datetime
8
+ import markdown
9
  from datetime import date
10
  from pathlib import Path
11
  from typing import Dict, List, Any, Optional, Tuple
 
67
  readme_path = course_dir / "README.md"
68
  title = course_dir.name.replace("_", " ").title()
69
  description = ""
70
+ description_html = ""
71
 
72
  if readme_path.exists():
73
  with open(readme_path, "r", encoding="utf-8") as f:
 
81
  # Extract description from content after first heading
82
  desc_content = "\n".join(content.split("\n")[1:]).strip()
83
  if desc_content:
84
+ # Take first paragraph as description, preserve markdown formatting
85
+ description = desc_content.split("\n\n")[0].strip()
86
+ # Convert markdown to HTML
87
+ description_html = markdown.markdown(description)
88
 
89
  return {
90
  "title": title,
91
+ "description": description,
92
+ "description_html": description_html
93
  }
94
 
95
 
 
124
  "id": course_id,
125
  "title": course_metadata["title"],
126
  "description": course_metadata["description"],
127
+ "description_html": course_metadata["description_html"],
128
  "notebooks": []
129
  }
130
 
scripts/templates/index.html CHANGED
@@ -27,7 +27,7 @@
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>
@@ -36,7 +36,7 @@
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>
@@ -90,31 +90,28 @@
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>
@@ -143,7 +140,7 @@
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>&copy; {{ 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">
 
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>
 
36
  </div>
37
  <div class="md:w-1/2">
38
  <div class="bg-light p-1 rounded-lg">
39
+ <img src="https://github.com/marimo-team/learn/blob/main/assets/marimo-learn.png?raw=true" alt="Marimo Logo" class="w-64 h-64 mx-auto object-contain">
40
  </div>
41
  </div>
42
  </div>
 
90
 
91
  {% if notebook_count > 0 %}
92
  {% set title = course.get('title', course_id|replace('_', ' ')|title) %}
 
 
 
 
93
 
94
  <div class="bg-white border border-gray-200 rounded-lg overflow-hidden hover-grow card-shadow">
95
  <div class="h-2 bg-primary"></div>
96
  <div class="p-6">
97
  <h3 class="text-xl font-semibold mb-2">{{ title }}</h3>
98
+ <p class="text-gray-600 mb-4">
99
+ {% if course.get('description_html') %}
100
+ {{ course.get('description_html')|safe }}
101
+ {% endif %}
102
+ </p>
103
  <div class="mb-4">
104
  <span class="text-sm text-gray-500 block mb-2">{{ notebook_count }} notebooks:</span>
105
+ <ol class="space-y-1 list-decimal pl-5">
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
  {{ notebook_title }}
111
  </a>
112
  </li>
113
  {% endfor %}
114
+ </ol>
115
  </div>
116
  </div>
117
  </div>
 
140
  <div class="container mx-auto px-4 max-w-6xl">
141
  <div class="flex flex-col md:flex-row justify-between items-center">
142
  <div class="mb-4 md:mb-0">
143
+ <p>&copy; {{ current_year }} marimo. All rights reserved.</p>
144
  </div>
145
  <div class="flex space-x-4">
146
  <a href="https://github.com/marimo-team/learn" target="_blank" class="text-gray-300 hover:text-white transition duration-300">
scripts/templates/tailwind_base.html DELETED
@@ -1,53 +0,0 @@
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 DELETED
@@ -1,12 +0,0 @@
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 DELETED
@@ -1,36 +0,0 @@
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 DELETED
@@ -1,34 +0,0 @@
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 DELETED
@@ -1,21 +0,0 @@
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>&copy; {{ 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 DELETED
@@ -1,19 +0,0 @@
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>