chalknotes 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chalknotes",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "description": "A tool that simplifies blogs.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -53,36 +53,36 @@ const getPostBySlug = async (slug) => {
53
53
  function processBlock(block) {
54
54
  switch (block.type) {
55
55
  case "paragraph":
56
- return processRichText(block.paragraph.rich_text, "p", "mb-6 leading-relaxed text-gray-700");
56
+ return processRichText(block.paragraph.rich_text, "p", "mb-6 leading-7 text-gray-700 text-lg");
57
57
 
58
58
  case "heading_1":
59
- return processRichText(block.heading_1.rich_text, "h1", "text-3xl font-bold mb-6 mt-8 text-gray-900 border-b border-gray-200 pb-2");
59
+ return processRichText(block.heading_1.rich_text, "h1", "text-4xl font-bold mb-8 mt-12 text-gray-900 border-b-2 border-gray-200 pb-4");
60
60
 
61
61
  case "heading_2":
62
- return processRichText(block.heading_2.rich_text, "h2", "text-2xl font-semibold mb-4 mt-6 text-gray-900");
62
+ return processRichText(block.heading_2.rich_text, "h2", "text-3xl font-semibold mb-6 mt-10 text-gray-900");
63
63
 
64
64
  case "heading_3":
65
- return processRichText(block.heading_3.rich_text, "h3", "text-xl font-medium mb-3 mt-5 text-gray-900");
65
+ return processRichText(block.heading_3.rich_text, "h3", "text-2xl font-medium mb-4 mt-8 text-gray-900");
66
66
 
67
67
  case "bulleted_list_item":
68
- return processRichText(block.bulleted_list_item.rich_text, "li", "mb-2 ml-4");
68
+ return processRichText(block.bulleted_list_item.rich_text, "li", "mb-3 ml-6 leading-7 text-gray-700");
69
69
 
70
70
  case "numbered_list_item":
71
- return processRichText(block.numbered_list_item.rich_text, "li", "mb-2 ml-4");
71
+ return processRichText(block.numbered_list_item.rich_text, "li", "mb-3 ml-6 leading-7 text-gray-700");
72
72
 
73
73
  case "quote":
74
- return processRichText(block.quote.rich_text, "blockquote", "border-l-4 border-blue-500 pl-6 italic text-gray-600 mb-6 bg-blue-50 py-4 rounded-r-lg");
74
+ return processRichText(block.quote.rich_text, "blockquote", "border-l-4 border-blue-500 pl-8 italic text-gray-600 mb-8 bg-blue-50 py-6 rounded-r-lg text-lg leading-7");
75
75
 
76
76
  case "code":
77
77
  const codeContent = block.code.rich_text.map(text => text.plain_text).join("");
78
78
  const language = block.code.language || 'text';
79
- return `<pre class="bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto mb-6 text-sm"><code class="language-${language}">${escapeHtml(codeContent)}</code></pre>`;
79
+ return `<pre class="bg-gray-900 text-gray-100 p-6 rounded-lg overflow-x-auto mb-8 text-sm leading-6 shadow-lg"><code class="language-${language}">${escapeHtml(codeContent)}</code></pre>`;
80
80
 
81
81
  case "image":
82
82
  return processImage(block.image);
83
83
 
84
84
  case "divider":
85
- return '<hr class="my-8 border-gray-200" />';
85
+ return '<hr class="my-12 border-gray-300" />';
86
86
 
87
87
  case "callout":
88
88
  return processCallout(block.callout);
@@ -91,18 +91,18 @@ function processBlock(block) {
91
91
  return processToggle(block.toggle);
92
92
 
93
93
  case "table_of_contents":
94
- return '<div class="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6"><p class="text-blue-800 font-medium">📋 Table of Contents</p><p class="text-blue-600 text-sm">(Generated automatically)</p></div>';
94
+ return '<div class="bg-blue-50 border border-blue-200 rounded-lg p-6 mb-8 shadow-sm"><p class="text-blue-800 font-medium text-lg">📋 Table of Contents</p><p class="text-blue-600 text-sm mt-1">(Generated automatically)</p></div>';
95
95
 
96
96
  case "bookmark":
97
97
  return processBookmark(block.bookmark);
98
98
 
99
99
  case "equation":
100
- return `<div class="bg-gray-50 p-4 rounded-lg mb-6 text-center border border-gray-200"><p class="text-gray-600 mb-2">📐 Mathematical equation</p><p class="font-mono text-sm bg-white p-2 rounded border">${block.equation.expression}</p></div>`;
100
+ return `<div class="bg-gray-50 p-6 rounded-lg mb-8 text-center border border-gray-200 shadow-sm"><p class="text-gray-600 mb-3 font-medium">📐 Mathematical equation</p><p class="font-mono text-sm bg-white p-4 rounded border shadow-sm">${block.equation.expression}</p></div>`;
101
101
 
102
102
  default:
103
103
  // For unsupported blocks, try to extract plain text
104
104
  if (block[block.type]?.rich_text) {
105
- return processRichText(block[block.type].rich_text, "p", "mb-4 text-gray-500 italic");
105
+ return processRichText(block[block.type].rich_text, "p", "mb-6 text-gray-500 italic text-lg");
106
106
  }
107
107
  return "";
108
108
  }
@@ -118,58 +118,55 @@ function processImage(image) {
118
118
  const caption = image.caption?.map(text => text.plain_text).join("") || "";
119
119
  const altText = caption || "Image";
120
120
 
121
- // Get image size from Notion properties
122
- let sizeClass = "w-full"; // Default full width
121
+ // Check for Notion's size property in the block itself
123
122
  let maxWidthClass = "max-w-full";
123
+ let alignmentClass = "text-center";
124
124
 
125
- // Check if image has size information
126
- if (image.width && image.height) {
127
- // Calculate aspect ratio and apply appropriate sizing
128
- const aspectRatio = image.width / image.height;
129
-
130
- if (aspectRatio > 2) {
131
- // Wide images
132
- sizeClass = "w-full";
133
- maxWidthClass = "max-w-4xl";
134
- } else if (aspectRatio < 0.5) {
135
- // Tall images
136
- sizeClass = "w-full";
137
- maxWidthClass = "max-w-2xl";
138
- } else {
139
- // Square-ish images
140
- sizeClass = "w-full";
141
- maxWidthClass = "max-w-3xl";
142
- }
143
- }
144
-
145
- // Check for Notion's size property (if available)
125
+ // Try to get size from block properties (Notion API structure)
146
126
  if (image.size) {
147
127
  switch (image.size) {
148
128
  case 'small':
149
- maxWidthClass = "max-w-md";
129
+ maxWidthClass = "max-w-sm";
150
130
  break;
151
131
  case 'medium':
152
- maxWidthClass = "max-w-2xl";
132
+ maxWidthClass = "max-w-lg";
153
133
  break;
154
134
  case 'large':
155
- maxWidthClass = "max-w-4xl";
135
+ maxWidthClass = "max-w-2xl";
156
136
  break;
157
137
  default:
158
138
  maxWidthClass = "max-w-full";
159
139
  }
160
140
  }
161
141
 
162
- const responsiveClasses = `${sizeClass} ${maxWidthClass} h-auto rounded-lg shadow-sm`;
142
+ // Check for alignment in block properties
143
+ if (image.alignment) {
144
+ switch (image.alignment) {
145
+ case 'left':
146
+ alignmentClass = "text-left";
147
+ break;
148
+ case 'center':
149
+ alignmentClass = "text-center";
150
+ break;
151
+ case 'right':
152
+ alignmentClass = "text-right";
153
+ break;
154
+ default:
155
+ alignmentClass = "text-center";
156
+ }
157
+ }
158
+
159
+ const responsiveClasses = `w-full ${maxWidthClass} h-auto rounded-lg shadow-sm`;
163
160
 
164
161
  return `
165
- <figure class="my-6 text-center">
162
+ <figure class="my-8 ${alignmentClass}">
166
163
  <img
167
164
  src="${imageUrl}"
168
165
  alt="${escapeHtml(altText)}"
169
166
  class="${responsiveClasses}"
170
167
  loading="lazy"
171
168
  />
172
- ${caption ? `<figcaption class="text-center text-gray-500 mt-3 text-sm italic">${escapeHtml(caption)}</figcaption>` : ''}
169
+ ${caption ? `<figcaption class="text-gray-500 mt-3 text-sm italic">${escapeHtml(caption)}</figcaption>` : ''}
173
170
  </figure>
174
171
  `.trim();
175
172
  }
@@ -197,10 +194,10 @@ function processCallout(callout) {
197
194
  const colorClass = colorClasses[bgColor] || colorClasses.blue;
198
195
 
199
196
  return `
200
- <div class="${colorClass} border-l-4 p-4 my-6 rounded-r-lg shadow-sm">
197
+ <div class="${colorClass} border-l-4 p-6 my-8 rounded-r-lg shadow-sm">
201
198
  <div class="flex items-start">
202
- <span class="mr-3 text-xl flex-shrink-0">${icon}</span>
203
- <div class="flex-1 leading-relaxed">${content}</div>
199
+ <span class="mr-4 text-2xl flex-shrink-0">${icon}</span>
200
+ <div class="flex-1 leading-7 text-lg">${content}</div>
204
201
  </div>
205
202
  </div>
206
203
  `.trim();
@@ -216,14 +213,14 @@ function processBookmark(bookmark) {
216
213
  const title = bookmark.caption?.[0]?.plain_text || "Bookmark";
217
214
 
218
215
  return `
219
- <div class="my-6">
220
- <a href="${url}" target="_blank" rel="noopener noreferrer" class="block border border-gray-200 rounded-lg p-4 hover:border-gray-300 hover:shadow-md transition-all duration-200">
216
+ <div class="my-8">
217
+ <a href="${url}" target="_blank" rel="noopener noreferrer" class="block border border-gray-200 rounded-lg p-6 hover:border-gray-300 hover:shadow-lg transition-all duration-200 bg-white">
221
218
  <div class="flex items-center">
222
219
  <div class="flex-1 min-w-0">
223
- <p class="font-medium text-gray-900 truncate">${escapeHtml(title)}</p>
224
- <p class="text-sm text-gray-500 truncate">${url}</p>
220
+ <p class="font-semibold text-gray-900 truncate text-lg">${escapeHtml(title)}</p>
221
+ <p class="text-sm text-gray-500 truncate mt-1">${url}</p>
225
222
  </div>
226
- <svg class="w-5 h-5 text-gray-400 ml-3 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
223
+ <svg class="w-6 h-6 text-gray-400 ml-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
227
224
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path>
228
225
  </svg>
229
226
  </div>
@@ -240,13 +237,13 @@ function processBookmark(bookmark) {
240
237
  function processToggle(toggle) {
241
238
  const content = processRichText(toggle.rich_text, "div", "");
242
239
  return `
243
- <details class="my-4">
244
- <summary class="cursor-pointer font-medium text-gray-700 hover:text-gray-900">
240
+ <details class="my-6">
241
+ <summary class="cursor-pointer font-semibold text-gray-700 hover:text-gray-900 text-lg leading-7">
245
242
  ${content}
246
243
  </summary>
247
- <div class="mt-2 pl-4 border-l-2 border-gray-200">
244
+ <div class="mt-4 pl-6 border-l-2 border-gray-200">
248
245
  <!-- Toggle content would go here if Notion API provided it -->
249
- <p class="text-gray-600 text-sm">Toggle content not available in current API</p>
246
+ <p class="text-gray-600 text-base italic">Toggle content not available in current API</p>
250
247
  </div>
251
248
  </details>
252
249
  `.trim();
@@ -266,13 +263,13 @@ function processRichText(richText, tag, className) {
266
263
  let result = text.plain_text;
267
264
 
268
265
  // Apply annotations
269
- if (text.annotations.bold) result = `<strong>${result}</strong>`;
270
- if (text.annotations.italic) result = `<em>${result}</em>`;
271
- if (text.annotations.strikethrough) result = `<del>${result}</del>`;
272
- if (text.annotations.code) result = `<code class="bg-gray-100 px-1 py-0.5 rounded text-sm font-mono">${result}</code>`;
266
+ if (text.annotations.bold) result = `<strong class="font-bold">${result}</strong>`;
267
+ if (text.annotations.italic) result = `<em class="italic">${result}</em>`;
268
+ if (text.annotations.strikethrough) result = `<del class="line-through">${result}</del>`;
269
+ if (text.annotations.code) result = `<code class="bg-gray-100 px-2 py-1 rounded text-sm font-mono text-gray-800">${result}</code>`;
273
270
 
274
271
  // Apply links
275
- if (text.href) result = `<a href="${text.href}" class="text-blue-600 hover:text-blue-800 underline" target="_blank" rel="noopener noreferrer">${result}</a>`;
272
+ if (text.href) result = `<a href="${text.href}" class="text-blue-600 hover:text-blue-800 underline font-medium" target="_blank" rel="noopener noreferrer">${result}</a>`;
276
273
 
277
274
  return result;
278
275
  }).join("");