tatht commited on
Commit
2bd0113
·
verified ·
1 Parent(s): f87bf4e

Trang web parse markdown - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +404 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Markdown Parser
3
- emoji: 👁
4
- colorFrom: blue
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: markdown-parser
3
+ emoji: 🐳
4
+ colorFrom: gray
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,404 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Markdown Parser</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
9
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
10
+ <script>
11
+ tailwind.config = {
12
+ theme: {
13
+ extend: {
14
+ colors: {
15
+ primary: '#4F46E5',
16
+ secondary: '#818CF8',
17
+ dark: '#1E293B',
18
+ light: '#F8FAFC'
19
+ }
20
+ }
21
+ }
22
+ }
23
+ </script>
24
+ <style>
25
+ .markdown-body {
26
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
27
+ line-height: 1.6;
28
+ color: #333;
29
+ }
30
+ .markdown-body h1 {
31
+ font-size: 2em;
32
+ border-bottom: 1px solid #eaecef;
33
+ padding-bottom: 0.3em;
34
+ margin-top: 1em;
35
+ margin-bottom: 0.8em;
36
+ }
37
+ .markdown-body h2 {
38
+ font-size: 1.5em;
39
+ border-bottom: 1px solid #eaecef;
40
+ padding-bottom: 0.3em;
41
+ margin-top: 1em;
42
+ margin-bottom: 0.8em;
43
+ }
44
+ .markdown-body h3 {
45
+ font-size: 1.25em;
46
+ margin-top: 1em;
47
+ margin-bottom: 0.6em;
48
+ }
49
+ .markdown-body p {
50
+ margin-bottom: 1em;
51
+ }
52
+ .markdown-body ul, .markdown-body ol {
53
+ padding-left: 2em;
54
+ margin-bottom: 1em;
55
+ }
56
+ .markdown-body blockquote {
57
+ border-left: 4px solid #dfe2e5;
58
+ padding: 0 1em;
59
+ color: #6a737d;
60
+ margin-bottom: 1em;
61
+ }
62
+ .markdown-body pre {
63
+ background-color: #f6f8fa;
64
+ padding: 1em;
65
+ border-radius: 6px;
66
+ overflow: auto;
67
+ margin-bottom: 1em;
68
+ }
69
+ .markdown-body code {
70
+ background-color: rgba(175,184,193,0.2);
71
+ padding: 0.2em 0.4em;
72
+ border-radius: 6px;
73
+ font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
74
+ }
75
+ .markdown-body table {
76
+ border-collapse: collapse;
77
+ width: 100%;
78
+ margin-bottom: 1em;
79
+ }
80
+ .markdown-body th, .markdown-body td {
81
+ border: 1px solid #dfe2e5;
82
+ padding: 6px 13px;
83
+ }
84
+ .markdown-body th {
85
+ background-color: #f6f8fa;
86
+ font-weight: 600;
87
+ }
88
+ .markdown-body tr:nth-child(even) {
89
+ background-color: #f6f8fa;
90
+ }
91
+ .editor, .preview {
92
+ min-height: 500px;
93
+ }
94
+ .resize-handle {
95
+ width: 4px;
96
+ background-color: #c7d2fe;
97
+ cursor: col-resize;
98
+ transition: background-color 0.2s;
99
+ }
100
+ .resize-handle:hover {
101
+ background-color: #818CF8;
102
+ }
103
+ .tab-btn {
104
+ border-bottom: 3px solid #4F46E5;
105
+ color: #4F46E5;
106
+ font-weight: 600;
107
+ }
108
+ .syntax-highlight {
109
+ color: #d63384;
110
+ }
111
+ .hljs {
112
+ display: block;
113
+ overflow-x: auto;
114
+ padding: 0.5em;
115
+ background: #f8f8f8;
116
+ }
117
+ </style>
118
+ </head>
119
+ <body class="bg-gray-50">
120
+ <header class="bg-gradient-to-r from-primary to-secondary text-white shadow-lg">
121
+ <div class="container mx-auto px-4 py-6">
122
+ <div class="flex items-center justify-between">
123
+ <div class="flex items-center space-x-3">
124
+ <i class="fas fa-code text-2xl"></i>
125
+ <h1 class="text-2xl md:text-3xl font-bold">Markdown Parser</h1>
126
+ </div>
127
+ <div class="flex space-x-4">
128
+ <button class="bg-white text-primary px-4 py-2 rounded-lg font-medium hover:bg-gray-100 transition">
129
+ <i class="fas fa-download mr-2"></i>Export
130
+ </button>
131
+ <button class="bg-white text-primary px-4 py-2 rounded-lg font-medium hover:bg-gray-100 transition">
132
+ <i class="fas fa-share-alt mr-2"></i>Share
133
+ </button>
134
+ </div>
135
+ </div>
136
+ </div>
137
+ </header>
138
+
139
+ <main class="container mx-auto px-4 py-8">
140
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden">
141
+ <!-- Tabs -->
142
+ <div class="flex border-b">
143
+ <button id="editor-tab" class="tab-btn px-6 py-4 text-sm md:text-base">Editor</button>
144
+ <button id="preview-tab" class="px-6 py-4 text-sm md:text-base text-gray-600 hover:text-primary">Preview</button>
145
+ <button id="split-tab" class="px-6 py-4 text-sm md:text-base text-gray-600 hover:text-primary">Split View</button>
146
+ </div>
147
+
148
+ <!-- Editor and Preview Area -->
149
+ <div class="flex flex-col md:flex-row" id="content-area">
150
+ <!-- Editor -->
151
+ <div class="w-full md:w-1/2" id="editor-container">
152
+ <div class="p-4 bg-gray-50 border-b md:border-b-0 md:border-r border-gray-200">
153
+ <div class="flex justify-between items-center mb-2">
154
+ <h3 class="font-medium text-gray-700">
155
+ <i class="fas fa-edit mr-2 text-secondary"></i>Markdown Editor
156
+ </h3>
157
+ <div class="text-sm text-gray-500">
158
+ <span id="line-count">0</span> lines
159
+ </div>
160
+ </div>
161
+ <textarea id="editor" class="editor w-full h-96 p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent font-mono text-sm" placeholder="Start typing your Markdown here..."># Welcome to Markdown Parser
162
+
163
+ ## This is a simple Markdown editor
164
+
165
+ You can write **bold text**, *italic text*, and even ~~strikethrough~~.
166
+
167
+ ### Lists
168
+
169
+ - Item 1
170
+ - Item 2
171
+ - Item 3
172
+
173
+ ### Code Block
174
+
175
+ ```javascript
176
+ function helloWorld() {
177
+ console.log("Hello, Markdown!");
178
+ }
179
+ ```
180
+
181
+ ### Blockquote
182
+
183
+ > This is a blockquote. It can span multiple lines.
184
+
185
+ ### Table
186
+
187
+ | Syntax | Description |
188
+ | ----------- | ----------- |
189
+ | Header | Title |
190
+ | Paragraph | Text |
191
+
192
+ ### Link
193
+
194
+ [Visit GitHub](https://github.com)
195
+
196
+ ### Image
197
+
198
+ ![Markdown Logo](https://markdown-here.com/img/icon256.png)</textarea>
199
+ </div>
200
+ </div>
201
+
202
+ <!-- Resize Handle -->
203
+ <div class="resize-handle hidden md:block" id="resize-handle"></div>
204
+
205
+ <!-- Preview -->
206
+ <div class="w-full md:w-1/2" id="preview-container">
207
+ <div class="p-4">
208
+ <div class="flex justify-between items-center mb-2">
209
+ <h3 class="font-medium text-gray-700">
210
+ <i class="fas fa-eye mr-2 text-secondary"></i>Preview
211
+ </h3>
212
+ <div class="text-sm text-gray-500">
213
+ <span id="word-count">0</span> words
214
+ </div>
215
+ </div>
216
+ <div id="preview" class="preview markdown-body p-4 border border-gray-300 rounded-lg overflow-auto h-96 bg-white"></div>
217
+ </div>
218
+ </div>
219
+ </div>
220
+ </div>
221
+
222
+ <!-- Markdown Cheatsheet -->
223
+ <div class="mt-8 bg-white rounded-xl shadow-lg overflow-hidden">
224
+ <div class="bg-gray-50 px-4 py-3 border-b">
225
+ <h2 class="text-lg font-semibold text-gray-800">
226
+ <i class="fas fa-book mr-2 text-primary"></i>Markdown Cheatsheet
227
+ </h2>
228
+ </div>
229
+ <div class="p-4">
230
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
231
+ <div class="p-3 border rounded-lg">
232
+ <h3 class="font-medium text-gray-800 mb-2">Text</h3>
233
+ <p><code>**Bold**</code> → <strong>Bold</strong></p>
234
+ <p><code>*Italic*</code> → <em>Italic</em></p>
235
+ <p><code>~~Strikethrough~~</code> → <s>Strikethrough</s></p>
236
+ </div>
237
+ <div class="p-3 border rounded-lg">
238
+ <h3 class="font-medium text-gray-800 mb-2">Headers</h3>
239
+ <p><code># H1</code></p>
240
+ <p><code>## H2</code></p>
241
+ <p><code>### H3</code></p>
242
+ </div>
243
+ <div class="p-3 border rounded-lg">
244
+ <h3 class="font-medium text-gray-800 mb-2">Lists</h3>
245
+ <p><code>- Item 1</code></p>
246
+ <p><code>- Item 2</code></p>
247
+ <p><code>1. Ordered 1</code></p>
248
+ <p><code>2. Ordered 2</code></p>
249
+ </div>
250
+ <div class="p-3 border rounded-lg">
251
+ <h3 class="font-medium text-gray-800 mb-2">Other</h3>
252
+ <p><code>[Link](url)</code></p>
253
+ <p><code>![Image](src)</code></p>
254
+ <p><code>&gt; Blockquote</code></p>
255
+ <p><code>``` Code block ```</code></p>
256
+ </div>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ </main>
261
+
262
+ <footer class="bg-dark text-gray-300 py-8 mt-12">
263
+ <div class="container mx-auto px-4">
264
+ <div class="flex flex-col md:flex-row justify-between items-center">
265
+ <div class="mb-4 md:mb-0">
266
+ <h3 class="text-xl font-bold text-white">Markdown Parser</h3>
267
+ <p class="mt-2">A simple and powerful Markdown editor</p>
268
+ </div>
269
+ <div class="flex space-x-6">
270
+ <a href="#" class="hover:text-white transition"><i class="fab fa-github text-xl"></i></a>
271
+ <a href="#" class="hover:text-white transition"><i class="fab fa-twitter text-xl"></i></a>
272
+ <a href="#" class="hover:text-white transition"><i class="fab fa-linkedin text-xl"></i></a>
273
+ </div>
274
+ </div>
275
+ <div class="mt-8 text-center text-sm">
276
+ <p>© 2023 Markdown Parser. All rights reserved.</p>
277
+ </div>
278
+ </div>
279
+ </footer>
280
+
281
+ <script>
282
+ // Initialize Marked.js
283
+ marked.setOptions({
284
+ breaks: true,
285
+ highlight: function(code, lang) {
286
+ return code;
287
+ }
288
+ });
289
+
290
+ // Get DOM elements
291
+ const editor = document.getElementById('editor');
292
+ const preview = document.getElementById('preview');
293
+ const lineCount = document.getElementById('line-count');
294
+ const wordCount = document.getElementById('word-count');
295
+ const editorTab = document.getElementById('editor-tab');
296
+ const previewTab = document.getElementById('preview-tab');
297
+ const splitTab = document.getElementById('split-tab');
298
+ const editorContainer = document.getElementById('editor-container');
299
+ const previewContainer = document.getElementById('preview-container');
300
+ const resizeHandle = document.getElementById('resize-handle');
301
+ const contentArea = document.getElementById('content-area');
302
+
303
+ // Initial render
304
+ updatePreview();
305
+ updateCounts();
306
+
307
+ // Event listeners
308
+ editor.addEventListener('input', () => {
309
+ updatePreview();
310
+ updateCounts();
311
+ });
312
+
313
+ // Tab switching
314
+ editorTab.addEventListener('click', () => {
315
+ setActiveTab('editor');
316
+ });
317
+
318
+ previewTab.addEventListener('click', () => {
319
+ setActiveTab('preview');
320
+ });
321
+
322
+ splitTab.addEventListener('click', () => {
323
+ setActiveTab('split');
324
+ });
325
+
326
+ // Resize functionality
327
+ let isResizing = false;
328
+
329
+ resizeHandle.addEventListener('mousedown', (e) => {
330
+ isResizing = true;
331
+ document.body.style.cursor = 'col-resize';
332
+ e.preventDefault();
333
+ });
334
+
335
+ document.addEventListener('mousemove', (e) => {
336
+ if (!isResizing) return;
337
+
338
+ const containerRect = contentArea.getBoundingClientRect();
339
+ const containerWidth = containerRect.width;
340
+ const mouseX = e.clientX - containerRect.left;
341
+
342
+ const editorWidth = (mouseX / containerWidth) * 100;
343
+ const previewWidth = 100 - editorWidth;
344
+
345
+ editorContainer.style.width = `${editorWidth}%`;
346
+ previewContainer.style.width = `${previewWidth}%`;
347
+ });
348
+
349
+ document.addEventListener('mouseup', () => {
350
+ isResizing = false;
351
+ document.body.style.cursor = 'default';
352
+ });
353
+
354
+ // Functions
355
+ function updatePreview() {
356
+ const markdownText = editor.value;
357
+ preview.innerHTML = marked.parse(markdownText);
358
+ }
359
+
360
+ function updateCounts() {
361
+ // Line count
362
+ const lines = editor.value.split('\n').length;
363
+ lineCount.textContent = lines;
364
+
365
+ // Word count
366
+ const words = editor.value.trim() === '' ? 0 : editor.value.trim().length;
367
+ wordCount.textContent = words;
368
+ }
369
+
370
+ function setActiveTab(tab) {
371
+ // Reset all tabs
372
+ editorTab.classList.remove('tab-btn');
373
+ previewTab.classList.remove('tab-btn');
374
+ splitTab.classList.remove('tab-btn');
375
+ editorTab.classList.add('text-gray-600');
376
+ previewTab.classList.add('text-gray-600');
377
+ splitTab.classList.add('text-gray-600');
378
+
379
+ // Hide/show elements based on tab
380
+ if (tab === 'editor') {
381
+ editorTab.classList.add('tab-btn');
382
+ editorContainer.classList.remove('hidden');
383
+ previewContainer.classList.add('hidden');
384
+ resizeHandle.classList.add('hidden');
385
+ } else if (tab === 'preview') {
386
+ previewTab.classList.add('tab-btn');
387
+ editorContainer.classList.add('hidden');
388
+ previewContainer.classList.remove('hidden');
389
+ resizeHandle.classList.add('hidden');
390
+ } else {
391
+ splitTab.classList.add('tab-btn');
392
+ editorContainer.classList.remove('hidden');
393
+ previewContainer.classList.remove('hidden');
394
+ resizeHandle.classList.remove('hidden');
395
+ editorContainer.style.width = '50%';
396
+ previewContainer.style.width = '50%';
397
+ }
398
+ }
399
+
400
+ // Initialize with split view
401
+ setActiveTab('split');
402
+ </script>
403
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=tatht/markdown-parser" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
404
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Trang web parse markdown