htmlgen-mcp 0.2.0__py3-none-any.whl

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.

Potentially problematic release.


This version of htmlgen-mcp might be problematic. Click here for more details.

@@ -0,0 +1,475 @@
1
+ """简单CSS样式工具 - 轻量级样式生成"""
2
+ from __future__ import annotations
3
+
4
+ from pathlib import Path
5
+
6
+
7
+ def create_clean_css_file(file_path: str) -> str:
8
+ """创建干净简洁的CSS样式文件"""
9
+
10
+ css_content = """/* 简洁干净的CSS样式 */
11
+
12
+ /* 基础重置 */
13
+ * {
14
+ margin: 0;
15
+ padding: 0;
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ body {
20
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
21
+ line-height: 1.6;
22
+ color: #333;
23
+ background-color: #fff;
24
+ }
25
+
26
+ /* 布局 */
27
+ .container {
28
+ max-width: 1200px;
29
+ margin: 0 auto;
30
+ padding: 0 20px;
31
+ }
32
+
33
+ /* 标题 */
34
+ h1, h2, h3, h4, h5, h6 {
35
+ margin-bottom: 1rem;
36
+ font-weight: 600;
37
+ line-height: 1.2;
38
+ }
39
+
40
+ h1 { font-size: 2.5rem; }
41
+ h2 { font-size: 2rem; }
42
+ h3 { font-size: 1.5rem; }
43
+
44
+ /* 段落 */
45
+ p {
46
+ margin-bottom: 1rem;
47
+ }
48
+
49
+ /* 链接 */
50
+ a {
51
+ color: #007bff;
52
+ text-decoration: none;
53
+ }
54
+
55
+ a:hover {
56
+ text-decoration: underline;
57
+ }
58
+
59
+ /* 导航 */
60
+ nav {
61
+ padding: 1rem 0;
62
+ }
63
+
64
+ nav a {
65
+ margin-right: 2rem;
66
+ font-weight: 500;
67
+ }
68
+
69
+ /* 区块 */
70
+ section {
71
+ margin: 3rem 0;
72
+ padding: 2rem 0;
73
+ }
74
+
75
+ /* 页脚 */
76
+ footer {
77
+ background-color: #f8f9fa;
78
+ padding: 2rem 0;
79
+ text-align: center;
80
+ margin-top: 3rem;
81
+ border-top: 1px solid #e9ecef;
82
+ }
83
+
84
+ /* 按钮 */
85
+ button, .button {
86
+ background-color: #007bff;
87
+ color: white;
88
+ border: none;
89
+ padding: 0.75rem 1.5rem;
90
+ border-radius: 4px;
91
+ cursor: pointer;
92
+ font-size: 1rem;
93
+ font-weight: 500;
94
+ }
95
+
96
+ button:hover, .button:hover {
97
+ background-color: #0056b3;
98
+ }
99
+
100
+ /* 响应式 */
101
+ @media (max-width: 768px) {
102
+ .container {
103
+ padding: 0 15px;
104
+ }
105
+
106
+ h1 { font-size: 2rem; }
107
+ h2 { font-size: 1.5rem; }
108
+
109
+ nav a {
110
+ margin-right: 1rem;
111
+ display: inline-block;
112
+ margin-bottom: 0.5rem;
113
+ }
114
+ }"""
115
+
116
+ try:
117
+ Path(file_path).parent.mkdir(parents=True, exist_ok=True)
118
+ with open(file_path, "w", encoding="utf-8") as f:
119
+ f.write(css_content)
120
+ return f"简洁CSS文件创建成功: {file_path}"
121
+ except Exception as exc:
122
+ raise RuntimeError(f"创建CSS文件失败: {str(exc)}")
123
+
124
+
125
+ def create_landing_css_file(file_path: str) -> str:
126
+ """创建着陆页CSS样式"""
127
+
128
+ css_content = """/* 着陆页样式 */
129
+
130
+ /* 基础重置 */
131
+ * {
132
+ margin: 0;
133
+ padding: 0;
134
+ box-sizing: border-box;
135
+ }
136
+
137
+ body {
138
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
139
+ line-height: 1.6;
140
+ color: #333;
141
+ }
142
+
143
+ .container {
144
+ max-width: 1200px;
145
+ margin: 0 auto;
146
+ padding: 0 20px;
147
+ }
148
+
149
+ /* 主要区域 */
150
+ .hero {
151
+ text-align: center;
152
+ padding: 4rem 0;
153
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
154
+ color: white;
155
+ min-height: 60vh;
156
+ display: flex;
157
+ flex-direction: column;
158
+ justify-content: center;
159
+ }
160
+
161
+ .hero h1 {
162
+ font-size: 3rem;
163
+ margin-bottom: 1rem;
164
+ font-weight: 700;
165
+ }
166
+
167
+ .subtitle {
168
+ font-size: 1.25rem;
169
+ margin-bottom: 2rem;
170
+ opacity: 0.9;
171
+ max-width: 600px;
172
+ margin-left: auto;
173
+ margin-right: auto;
174
+ }
175
+
176
+ .cta-button {
177
+ background-color: #fff;
178
+ color: #667eea;
179
+ border: none;
180
+ padding: 1rem 2rem;
181
+ font-size: 1.1rem;
182
+ font-weight: 600;
183
+ border-radius: 8px;
184
+ cursor: pointer;
185
+ transition: all 0.3s ease;
186
+ }
187
+
188
+ .cta-button:hover {
189
+ transform: translateY(-2px);
190
+ box-shadow: 0 8px 25px rgba(0,0,0,0.2);
191
+ }
192
+
193
+ /* 特点区域 */
194
+ .features {
195
+ display: grid;
196
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
197
+ gap: 2rem;
198
+ padding: 4rem 0;
199
+ }
200
+
201
+ .feature {
202
+ text-align: center;
203
+ padding: 2rem;
204
+ border-radius: 8px;
205
+ background-color: #f8f9fa;
206
+ }
207
+
208
+ .feature h3 {
209
+ margin-bottom: 1rem;
210
+ color: #495057;
211
+ font-size: 1.5rem;
212
+ }
213
+
214
+ .feature p {
215
+ color: #6c757d;
216
+ line-height: 1.6;
217
+ }
218
+
219
+ /* 页脚 */
220
+ footer {
221
+ background-color: #343a40;
222
+ color: white;
223
+ text-align: center;
224
+ padding: 2rem 0;
225
+ }
226
+
227
+ /* 响应式 */
228
+ @media (max-width: 768px) {
229
+ .hero h1 {
230
+ font-size: 2.25rem;
231
+ }
232
+
233
+ .subtitle {
234
+ font-size: 1.1rem;
235
+ }
236
+
237
+ .features {
238
+ grid-template-columns: 1fr;
239
+ gap: 1.5rem;
240
+ }
241
+ }"""
242
+
243
+ try:
244
+ Path(file_path).parent.mkdir(parents=True, exist_ok=True)
245
+ with open(file_path, "w", encoding="utf-8") as f:
246
+ f.write(css_content)
247
+ return f"着陆页CSS文件创建成功: {file_path}"
248
+ except Exception as exc:
249
+ raise RuntimeError(f"创建CSS文件失败: {str(exc)}")
250
+
251
+
252
+ def create_blog_css_file(file_path: str) -> str:
253
+ """创建博客CSS样式"""
254
+
255
+ css_content = """/* 博客样式 */
256
+
257
+ /* 基础重置 */
258
+ * {
259
+ margin: 0;
260
+ padding: 0;
261
+ box-sizing: border-box;
262
+ }
263
+
264
+ body {
265
+ font-family: Georgia, "Times New Roman", serif;
266
+ line-height: 1.7;
267
+ color: #333;
268
+ background-color: #fafafa;
269
+ }
270
+
271
+ .container {
272
+ max-width: 1000px;
273
+ margin: 0 auto;
274
+ padding: 0 20px;
275
+ display: grid;
276
+ grid-template-columns: 2fr 1fr;
277
+ gap: 3rem;
278
+ }
279
+
280
+ /* 头部 */
281
+ header {
282
+ background-color: white;
283
+ border-bottom: 1px solid #e9ecef;
284
+ padding: 2rem 0;
285
+ margin-bottom: 3rem;
286
+ grid-column: 1 / -1;
287
+ }
288
+
289
+ header h1 {
290
+ font-size: 2.5rem;
291
+ margin-bottom: 1rem;
292
+ color: #2c3e50;
293
+ }
294
+
295
+ nav a {
296
+ margin-right: 2rem;
297
+ color: #6c757d;
298
+ text-decoration: none;
299
+ font-weight: 500;
300
+ }
301
+
302
+ nav a:hover {
303
+ color: #2c3e50;
304
+ }
305
+
306
+ /* 主要内容 */
307
+ main {
308
+ background-color: white;
309
+ }
310
+
311
+ .post {
312
+ background-color: white;
313
+ padding: 2rem;
314
+ margin-bottom: 2rem;
315
+ border-radius: 8px;
316
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
317
+ }
318
+
319
+ .post h2 {
320
+ color: #2c3e50;
321
+ font-size: 1.75rem;
322
+ margin-bottom: 0.5rem;
323
+ }
324
+
325
+ .meta {
326
+ color: #6c757d;
327
+ font-size: 0.9rem;
328
+ margin-bottom: 1rem;
329
+ font-style: italic;
330
+ }
331
+
332
+ .post p {
333
+ font-size: 1.1rem;
334
+ line-height: 1.8;
335
+ margin-bottom: 1rem;
336
+ }
337
+
338
+ /* 侧边栏 */
339
+ .sidebar {
340
+ padding-top: 0;
341
+ }
342
+
343
+ .widget {
344
+ background-color: white;
345
+ padding: 1.5rem;
346
+ margin-bottom: 2rem;
347
+ border-radius: 8px;
348
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
349
+ }
350
+
351
+ .widget h3 {
352
+ color: #2c3e50;
353
+ margin-bottom: 1rem;
354
+ font-size: 1.25rem;
355
+ }
356
+
357
+ .widget ul {
358
+ list-style: none;
359
+ }
360
+
361
+ .widget li {
362
+ margin-bottom: 0.5rem;
363
+ }
364
+
365
+ .widget a {
366
+ color: #6c757d;
367
+ text-decoration: none;
368
+ }
369
+
370
+ .widget a:hover {
371
+ color: #2c3e50;
372
+ }
373
+
374
+ /* 页脚 */
375
+ footer {
376
+ background-color: #2c3e50;
377
+ color: white;
378
+ text-align: center;
379
+ padding: 2rem 0;
380
+ margin-top: 3rem;
381
+ grid-column: 1 / -1;
382
+ }
383
+
384
+ /* 响应式 */
385
+ @media (max-width: 768px) {
386
+ .container {
387
+ grid-template-columns: 1fr;
388
+ gap: 2rem;
389
+ }
390
+
391
+ header h1 {
392
+ font-size: 2rem;
393
+ }
394
+
395
+ nav a {
396
+ display: inline-block;
397
+ margin-bottom: 0.5rem;
398
+ }
399
+
400
+ .post {
401
+ padding: 1.5rem;
402
+ }
403
+ }"""
404
+
405
+ try:
406
+ Path(file_path).parent.mkdir(parents=True, exist_ok=True)
407
+ with open(file_path, "w", encoding="utf-8") as f:
408
+ f.write(css_content)
409
+ return f"博客CSS文件创建成功: {file_path}"
410
+ except Exception as exc:
411
+ raise RuntimeError(f"创建CSS文件失败: {str(exc)}")
412
+
413
+
414
+ def create_minimal_css_file(file_path: str) -> str:
415
+ """创建极简CSS样式"""
416
+
417
+ css_content = """/* 极简样式 */
418
+
419
+ body {
420
+ font-family: system-ui, sans-serif;
421
+ line-height: 1.6;
422
+ max-width: 800px;
423
+ margin: 2rem auto;
424
+ padding: 0 1rem;
425
+ color: #333;
426
+ }
427
+
428
+ h1, h2, h3 {
429
+ margin: 1.5rem 0 0.5rem 0;
430
+ }
431
+
432
+ p {
433
+ margin-bottom: 1rem;
434
+ }
435
+
436
+ a {
437
+ color: #0066cc;
438
+ }
439
+
440
+ button {
441
+ background: #0066cc;
442
+ color: white;
443
+ border: none;
444
+ padding: 0.5rem 1rem;
445
+ border-radius: 4px;
446
+ cursor: pointer;
447
+ }
448
+
449
+ button:hover {
450
+ background: #0052a3;
451
+ }
452
+
453
+ footer {
454
+ margin-top: 3rem;
455
+ padding-top: 1rem;
456
+ border-top: 1px solid #ddd;
457
+ text-align: center;
458
+ color: #666;
459
+ }"""
460
+
461
+ try:
462
+ Path(file_path).parent.mkdir(parents=True, exist_ok=True)
463
+ with open(file_path, "w", encoding="utf-8") as f:
464
+ f.write(css_content)
465
+ return f"极简CSS文件创建成功: {file_path}"
466
+ except Exception as exc:
467
+ raise RuntimeError(f"创建CSS文件失败: {str(exc)}")
468
+
469
+
470
+ __all__ = [
471
+ "create_clean_css_file",
472
+ "create_landing_css_file",
473
+ "create_blog_css_file",
474
+ "create_minimal_css_file"
475
+ ]