@yeongjaeyou/claude-code-config 0.14.0 → 0.15.0
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.
|
@@ -25,16 +25,22 @@ Before using this skill, ensure the following setup is complete:
|
|
|
25
25
|
|
|
26
26
|
### 2. Environment Configuration
|
|
27
27
|
|
|
28
|
-
Set the API key in the environment:
|
|
28
|
+
Set the API key in the environment. The script automatically loads `.env` files if `python-dotenv` is installed:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
# In .env file
|
|
31
|
+
# In .env file (recommended - auto-loaded)
|
|
32
32
|
NOTION_API_KEY=ntn_xxxxx
|
|
33
33
|
|
|
34
34
|
# Or export directly
|
|
35
35
|
export NOTION_API_KEY=ntn_xxxxx
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
To install dotenv support:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv add python-dotenv
|
|
42
|
+
```
|
|
43
|
+
|
|
38
44
|
### 3. Page Access
|
|
39
45
|
|
|
40
46
|
Share the target parent page with the integration:
|
|
@@ -65,6 +71,8 @@ uv run python .claude/skills/notion-md-uploader/scripts/upload_md.py \
|
|
|
65
71
|
|
|
66
72
|
### Dry Run (Preview)
|
|
67
73
|
|
|
74
|
+
Preview parsing results and validate local images before uploading:
|
|
75
|
+
|
|
68
76
|
```bash
|
|
69
77
|
uv run python .claude/skills/notion-md-uploader/scripts/upload_md.py \
|
|
70
78
|
docs/analysis.md \
|
|
@@ -72,6 +80,11 @@ uv run python .claude/skills/notion-md-uploader/scripts/upload_md.py \
|
|
|
72
80
|
--dry-run
|
|
73
81
|
```
|
|
74
82
|
|
|
83
|
+
The dry run validates:
|
|
84
|
+
- Markdown block parsing
|
|
85
|
+
- Local image file existence
|
|
86
|
+
- Conversion to Notion blocks
|
|
87
|
+
|
|
75
88
|
## Supported Markdown Elements
|
|
76
89
|
|
|
77
90
|
| Element | Markdown Syntax | Notion Block |
|
|
@@ -18,10 +18,17 @@ import sys
|
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
+
# Load .env file if python-dotenv is available
|
|
22
|
+
try:
|
|
23
|
+
from dotenv import load_dotenv
|
|
24
|
+
load_dotenv()
|
|
25
|
+
except ImportError:
|
|
26
|
+
pass # python-dotenv not installed, use env vars directly
|
|
27
|
+
|
|
21
28
|
# Add scripts directory to path for imports
|
|
22
29
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
23
30
|
|
|
24
|
-
from markdown_parser import MarkdownParser
|
|
31
|
+
from markdown_parser import BlockType, MarkdownParser
|
|
25
32
|
from notion_client import NotionClient, NotionAPIError, NotionConfig
|
|
26
33
|
from notion_converter import NotionBlockConverter
|
|
27
34
|
|
|
@@ -236,8 +243,8 @@ Setup:
|
|
|
236
243
|
print(f"Parsing: {args.md_file}")
|
|
237
244
|
content = md_path.read_text(encoding="utf-8")
|
|
238
245
|
|
|
239
|
-
|
|
240
|
-
blocks =
|
|
246
|
+
md_parser = MarkdownParser(base_path=str(md_path.parent))
|
|
247
|
+
blocks = md_parser.parse(content)
|
|
241
248
|
|
|
242
249
|
print(f"Found {len(blocks)} blocks:")
|
|
243
250
|
for i, block in enumerate(blocks[:10]):
|
|
@@ -251,6 +258,34 @@ Setup:
|
|
|
251
258
|
if len(blocks) > 10:
|
|
252
259
|
print(f" ... and {len(blocks) - 10} more blocks")
|
|
253
260
|
|
|
261
|
+
# Validate image files
|
|
262
|
+
base_path = md_path.parent
|
|
263
|
+
image_blocks = [b for b in blocks if b.block_type == BlockType.IMAGE]
|
|
264
|
+
missing_images = []
|
|
265
|
+
found_images = []
|
|
266
|
+
|
|
267
|
+
for block in image_blocks:
|
|
268
|
+
img_src = block.metadata.get("url", "")
|
|
269
|
+
if img_src and not img_src.startswith(("http://", "https://")):
|
|
270
|
+
img_path = base_path / img_src
|
|
271
|
+
if img_path.exists():
|
|
272
|
+
found_images.append(str(img_src))
|
|
273
|
+
else:
|
|
274
|
+
missing_images.append(str(img_src))
|
|
275
|
+
|
|
276
|
+
if found_images:
|
|
277
|
+
print(f"\nLocal images ({len(found_images)}):")
|
|
278
|
+
for img in found_images[:5]:
|
|
279
|
+
print(f" [OK] {img}")
|
|
280
|
+
if len(found_images) > 5:
|
|
281
|
+
print(f" ... and {len(found_images) - 5} more")
|
|
282
|
+
|
|
283
|
+
if missing_images:
|
|
284
|
+
print(f"\nMissing images ({len(missing_images)}):")
|
|
285
|
+
for img in missing_images:
|
|
286
|
+
print(f" [MISSING] {img}")
|
|
287
|
+
print("\nWarning: Missing images will cause upload to fail.")
|
|
288
|
+
|
|
254
289
|
converter = NotionBlockConverter(base_path=str(md_path.parent))
|
|
255
290
|
notion_blocks = converter.convert_blocks(blocks)
|
|
256
291
|
print(f"\nConverted to {len(notion_blocks)} Notion blocks")
|
|
@@ -272,10 +307,13 @@ Setup:
|
|
|
272
307
|
|
|
273
308
|
page_url = page.get("url", "")
|
|
274
309
|
page_id = page.get("id", "")
|
|
310
|
+
image_count = len(uploader._uploaded_images)
|
|
275
311
|
|
|
276
312
|
print(f"\nSuccess!")
|
|
277
313
|
print(f"Page ID: {page_id}")
|
|
278
314
|
print(f"URL: {page_url}")
|
|
315
|
+
if image_count > 0:
|
|
316
|
+
print(f"Images uploaded: {image_count}")
|
|
279
317
|
|
|
280
318
|
except NotionAPIError as e:
|
|
281
319
|
print(f"\nNotion API Error: {e}")
|