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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>MarkView - Markdown Preview</title>
|
7 |
+
<style>
|
8 |
+
/* Vercel-like font */
|
9 |
+
body {
|
10 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
11 |
+
margin: 0;
|
12 |
+
padding: 0;
|
13 |
+
background-color: #000; /* Dark theme background */
|
14 |
+
color: #eaeaea; /* Light text for dark theme */
|
15 |
+
}
|
16 |
+
|
17 |
+
/* Container for the editor and preview */
|
18 |
+
.container {
|
19 |
+
max-width: 800px;
|
20 |
+
margin: 0 auto;
|
21 |
+
padding: 20px;
|
22 |
+
}
|
23 |
+
|
24 |
+
/* Header with logo */
|
25 |
+
.header {
|
26 |
+
display: flex;
|
27 |
+
align-items: center;
|
28 |
+
margin-bottom: 20px;
|
29 |
+
}
|
30 |
+
|
31 |
+
.logo {
|
32 |
+
font-size: 24px;
|
33 |
+
font-weight: bold;
|
34 |
+
color: #fff;
|
35 |
+
margin-right: 10px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.logo span {
|
39 |
+
color: #0070f3; /* Vercel-like blue accent */
|
40 |
+
}
|
41 |
+
|
42 |
+
/* Command dropdown */
|
43 |
+
.command-dropdown {
|
44 |
+
margin-bottom: 20px;
|
45 |
+
}
|
46 |
+
|
47 |
+
.command-dropdown select {
|
48 |
+
width: 100%;
|
49 |
+
padding: 10px;
|
50 |
+
border: 1px solid #333;
|
51 |
+
border-radius: 4px;
|
52 |
+
background-color: #000;
|
53 |
+
color: #eaeaea;
|
54 |
+
font-family: 'Inter', sans-serif;
|
55 |
+
font-size: 14px;
|
56 |
+
outline: none;
|
57 |
+
cursor: pointer;
|
58 |
+
}
|
59 |
+
|
60 |
+
.command-dropdown select:focus {
|
61 |
+
border-color: #0070f3;
|
62 |
+
box-shadow: 0 0 0 2px rgba(0, 112, 243, 0.1);
|
63 |
+
}
|
64 |
+
|
65 |
+
/* Playground modal */
|
66 |
+
.modal {
|
67 |
+
display: none;
|
68 |
+
position: fixed;
|
69 |
+
top: 0;
|
70 |
+
left: 0;
|
71 |
+
width: 100%;
|
72 |
+
height: 100%;
|
73 |
+
background-color: rgba(0, 0, 0, 0.8);
|
74 |
+
justify-content: center;
|
75 |
+
align-items: center;
|
76 |
+
z-index: 1000;
|
77 |
+
}
|
78 |
+
|
79 |
+
.modal-content {
|
80 |
+
background-color: #111;
|
81 |
+
padding: 20px;
|
82 |
+
border-radius: 8px;
|
83 |
+
width: 400px;
|
84 |
+
max-width: 90%;
|
85 |
+
}
|
86 |
+
|
87 |
+
.modal-content h2 {
|
88 |
+
margin-top: 0;
|
89 |
+
color: #fff;
|
90 |
+
}
|
91 |
+
|
92 |
+
.modal-content label {
|
93 |
+
display: block;
|
94 |
+
margin-bottom: 10px;
|
95 |
+
color: #eaeaea;
|
96 |
+
}
|
97 |
+
|
98 |
+
.modal-content input,
|
99 |
+
.modal-content select,
|
100 |
+
.modal-content textarea {
|
101 |
+
width: 100%;
|
102 |
+
padding: 10px;
|
103 |
+
border: 1px solid #333;
|
104 |
+
border-radius: 4px;
|
105 |
+
background-color: #000;
|
106 |
+
color: #eaeaea;
|
107 |
+
font-family: 'Inter', sans-serif;
|
108 |
+
font-size: 14px;
|
109 |
+
outline: none;
|
110 |
+
margin-bottom: 20px;
|
111 |
+
}
|
112 |
+
|
113 |
+
.modal-content button {
|
114 |
+
padding: 10px 20px;
|
115 |
+
border: none;
|
116 |
+
border-radius: 4px;
|
117 |
+
background-color: #0070f3;
|
118 |
+
color: #fff;
|
119 |
+
font-family: 'Inter', sans-serif;
|
120 |
+
font-size: 14px;
|
121 |
+
cursor: pointer;
|
122 |
+
}
|
123 |
+
|
124 |
+
.modal-content button:hover {
|
125 |
+
background-color: #005bb5;
|
126 |
+
}
|
127 |
+
|
128 |
+
/* Editor and Preview sections */
|
129 |
+
.editor, .preview {
|
130 |
+
background-color: #111; /* Darker background for sections */
|
131 |
+
border-radius: 8px;
|
132 |
+
padding: 20px;
|
133 |
+
margin-bottom: 20px;
|
134 |
+
}
|
135 |
+
|
136 |
+
textarea {
|
137 |
+
width: 100%;
|
138 |
+
height: 200px;
|
139 |
+
padding: 10px;
|
140 |
+
border: 1px solid #333;
|
141 |
+
border-radius: 4px;
|
142 |
+
font-family: 'JetBrains Mono', monospace; /* Monospace font for code */
|
143 |
+
font-size: 14px;
|
144 |
+
background-color: #000;
|
145 |
+
color: #eaeaea;
|
146 |
+
resize: vertical;
|
147 |
+
outline: none;
|
148 |
+
}
|
149 |
+
|
150 |
+
textarea:focus {
|
151 |
+
border-color: #0070f3;
|
152 |
+
box-shadow: 0 0 0 2px rgba(0, 112, 243, 0.1);
|
153 |
+
}
|
154 |
+
|
155 |
+
/* Preview styling */
|
156 |
+
.preview {
|
157 |
+
color: #eaeaea;
|
158 |
+
}
|
159 |
+
|
160 |
+
.preview h1, .preview h2, .preview h3 {
|
161 |
+
margin-top: 0;
|
162 |
+
color: #fff;
|
163 |
+
}
|
164 |
+
|
165 |
+
.preview code {
|
166 |
+
background-color: #333;
|
167 |
+
padding: 2px 4px;
|
168 |
+
border-radius: 4px;
|
169 |
+
font-family: 'JetBrains Mono', monospace;
|
170 |
+
color: #eaeaea;
|
171 |
+
}
|
172 |
+
|
173 |
+
.preview pre {
|
174 |
+
background-color: #333;
|
175 |
+
padding: 10px;
|
176 |
+
border-radius: 4px;
|
177 |
+
overflow-x: auto;
|
178 |
+
}
|
179 |
+
|
180 |
+
.preview blockquote {
|
181 |
+
border-left: 4px solid #0070f3;
|
182 |
+
padding-left: 10px;
|
183 |
+
color: #999;
|
184 |
+
margin: 0;
|
185 |
+
}
|
186 |
+
|
187 |
+
.preview a {
|
188 |
+
color: #0070f3;
|
189 |
+
text-decoration: none;
|
190 |
+
}
|
191 |
+
|
192 |
+
.preview a:hover {
|
193 |
+
text-decoration: underline;
|
194 |
+
}
|
195 |
+
|
196 |
+
/* Badge styling */
|
197 |
+
.preview img {
|
198 |
+
margin: 5px;
|
199 |
+
}
|
200 |
+
</style>
|
201 |
+
<!-- Load Inter font from Google Fonts -->
|
202 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap" rel="stylesheet">
|
203 |
+
<!-- Load JetBrains Mono font for code -->
|
204 |
+
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
205 |
+
</head>
|
206 |
+
<body>
|
207 |
+
|
208 |
+
<div class="container">
|
209 |
+
<!-- Header with logo -->
|
210 |
+
<div class="header">
|
211 |
+
<div class="logo">
|
212 |
+
Mark<span>View</span>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
|
216 |
+
<!-- Command dropdown -->
|
217 |
+
<div class="command-dropdown">
|
218 |
+
<select id="command-select">
|
219 |
+
<option value="">Select a command...</option>
|
220 |
+
<option value="/badge">Create a Badge</option>
|
221 |
+
<option value="/links">Links and Media</option>
|
222 |
+
<option value="/blocks">Blocks</option>
|
223 |
+
<option value="/lists">Lists</option>
|
224 |
+
<option value="/headings">Headings</option>
|
225 |
+
<option value="/text">Text Formatting</option>
|
226 |
+
<option value="/tables">Tables</option>
|
227 |
+
<option value="/tasks">Task Lists</option>
|
228 |
+
<option value="/hr">Horizontal Rule</option>
|
229 |
+
<option value="/emoji">Emojis</option>
|
230 |
+
<option value="/mention">Mentions</option>
|
231 |
+
</select>
|
232 |
+
</div>
|
233 |
+
|
234 |
+
<!-- Editor section -->
|
235 |
+
<div class="editor">
|
236 |
+
<textarea id="markdown-input" placeholder="Write your Markdown here..."># Welcome to MarkView
|
237 |
+
**Markdown Preview** with a *dark theme*.
|
238 |
+
|
239 |
+
- List item 1
|
240 |
+
- List item 2
|
241 |
+
|
242 |
+
`Inline code`
|
243 |
+
|
244 |
+
```javascript
|
245 |
+
function hello() {
|
246 |
+
console.log('Hello, MarkView!');
|
247 |
+
}
|
248 |
+
```</textarea>
|
249 |
+
</div>
|
250 |
+
|
251 |
+
<!-- Preview section -->
|
252 |
+
<div class="preview" id="markdown-preview">
|
253 |
+
<!-- Preview will be rendered here -->
|
254 |
+
</div>
|
255 |
+
</div>
|
256 |
+
|
257 |
+
<!-- Playground modals -->
|
258 |
+
<!-- Badge Modal -->
|
259 |
+
<div class="modal" id="badge-modal">
|
260 |
+
<div class="modal-content">
|
261 |
+
<h2>Create a Badge</h2>
|
262 |
+
<label for="badge-label">Label:</label>
|
263 |
+
<input type="text" id="badge-label" placeholder="e.g., version">
|
264 |
+
<label for="badge-message">Message:</label>
|
265 |
+
<input type="text" id="badge-message" placeholder="e.g., v1.0">
|
266 |
+
<label for="badge-color">Color:</label>
|
267 |
+
<input type="text" id="badge-color" placeholder="e.g., blue">
|
268 |
+
<label for="badge-icon">Icon:</label>
|
269 |
+
<select id="badge-icon">
|
270 |
+
<option value="">No Icon</option>
|
271 |
+
<option value="github">GitHub</option>
|
272 |
+
<option value="npm">npm</option>
|
273 |
+
<option value="docker">Docker</option>
|
274 |
+
<option value="python">Python</option>
|
275 |
+
<option value="javascript">JavaScript</option>
|
276 |
+
<option value="react">React</option>
|
277 |
+
<option value="vue">Vue</option>
|
278 |
+
<option value="angular">Angular</option>
|
279 |
+
<option value="apple">Apple</option>
|
280 |
+
<option value="windows">Windows</option>
|
281 |
+
</select>
|
282 |
+
<button id="insert-badge">Insert Badge</button>
|
283 |
+
</div>
|
284 |
+
</div>
|
285 |
+
|
286 |
+
<!-- Links and Media Modal -->
|
287 |
+
<div class="modal" id="links-modal">
|
288 |
+
<div class="modal-content">
|
289 |
+
<h2>Links and Media</h2>
|
290 |
+
<label for="link-text">Link Text:</label>
|
291 |
+
<input type="text" id="link-text" placeholder="e.g., Google">
|
292 |
+
<label for="link-url">URL:</label>
|
293 |
+
<input type="text" id="link-url" placeholder="e.g., https://google.com">
|
294 |
+
<label for="image-url">Image URL:</label>
|
295 |
+
<input type="text" id="image-url" placeholder="e.g., https://example.com/image.png">
|
296 |
+
<button id="insert-link">Insert Link</button>
|
297 |
+
<button id="insert-image">Insert Image</button>
|
298 |
+
</div>
|
299 |
+
</div>
|
300 |
+
|
301 |
+
<!-- Blocks Modal -->
|
302 |
+
<div class="modal" id="blocks-modal">
|
303 |
+
<div class="modal-content">
|
304 |
+
<h2>Blocks</h2>
|
305 |
+
<label for="block-type">Block Type:</label>
|
306 |
+
<select id="block-type">
|
307 |
+
<option value="code">Code Block</option>
|
308 |
+
<option value="quote">Blockquote</option>
|
309 |
+
</select>
|
310 |
+
<label for="block-content">Content:</label>
|
311 |
+
<textarea id="block-content" placeholder="Enter your content..."></textarea>
|
312 |
+
<button id="insert-block">Insert Block</button>
|
313 |
+
</div>
|
314 |
+
</div>
|
315 |
+
|
316 |
+
<!-- Lists Modal -->
|
317 |
+
<div class="modal" id="lists-modal">
|
318 |
+
<div class="modal-content">
|
319 |
+
<h2>Lists</h2>
|
320 |
+
<label for="list-type">List Type:</label>
|
321 |
+
<select id="list-type">
|
322 |
+
<option value="unordered">Unordered List</option>
|
323 |
+
<option value="ordered">Ordered List</option>
|
324 |
+
</select>
|
325 |
+
<label for="list-items">Items (one per line):</label>
|
326 |
+
<textarea id="list-items" placeholder="Enter items..."></textarea>
|
327 |
+
<button id="insert-list">Insert List</button>
|
328 |
+
</div>
|
329 |
+
</div>
|
330 |
+
|
331 |
+
<!-- Headings Modal -->
|
332 |
+
<div class="modal" id="headings-modal">
|
333 |
+
<div class="modal-content">
|
334 |
+
<h2>Headings</h2>
|
335 |
+
<label for="heading-level">Heading Level:</label>
|
336 |
+
<select id="heading-level">
|
337 |
+
<option value="1">Heading 1 (#)</option>
|
338 |
+
<option value="2">Heading 2 (##)</option>
|
339 |
+
<option value="3">Heading 3 (###)</option>
|
340 |
+
<option value="4">Heading 4 (####)</option>
|
341 |
+
<option value="5">Heading 5 (#####)</option>
|
342 |
+
<option value="6">Heading 6 (######)</option>
|
343 |
+
</select>
|
344 |
+
<label for="heading-text">Text:</label>
|
345 |
+
<input type="text" id="heading-text" placeholder="e.g., My Heading">
|
346 |
+
<button id="insert-heading">Insert Heading</button>
|
347 |
+
</div>
|
348 |
+
</div>
|
349 |
+
|
350 |
+
<!-- Text Formatting Modal -->
|
351 |
+
<div class="modal" id="text-modal">
|
352 |
+
<div class="modal-content">
|
353 |
+
<h2>Text Formatting</h2>
|
354 |
+
<label for="text-content">Text:</label>
|
355 |
+
<input type="text" id="text-content" placeholder="e.g., Hello, World!">
|
356 |
+
<label for="text-format">Format:</label>
|
357 |
+
<select id="text-format">
|
358 |
+
<option value="bold">Bold (**)</option>
|
359 |
+
<option value="italic">Italic (*)</option>
|
360 |
+
<option value="strikethrough">Strikethrough (~~)</option>
|
361 |
+
<option value="inline-code">Inline Code (`)</option>
|
362 |
+
</select>
|
363 |
+
<button id="insert-text">Insert Text</button>
|
364 |
+
</div>
|
365 |
+
</div>
|
366 |
+
|
367 |
+
<!-- Tables Modal -->
|
368 |
+
<div class="modal" id="tables-modal">
|
369 |
+
<div class="modal-content">
|
370 |
+
<h2>Tables</h2>
|
371 |
+
<label for="table-headers">Headers (comma-separated):</label>
|
372 |
+
<input type="text" id="table-headers" placeholder="e.g., Name, Age, City">
|
373 |
+
<label for="table-rows">Rows (one per line, comma-separated):</label>
|
374 |
+
<textarea id="table-rows" placeholder="e.g., John, 25, New York"></textarea>
|
375 |
+
<button id="insert-table">Insert Table</button>
|
376 |
+
</div>
|
377 |
+
</div>
|
378 |
+
|
379 |
+
<!-- Task Lists Modal -->
|
380 |
+
<div class="modal" id="tasks-modal">
|
381 |
+
<div class="modal-content">
|
382 |
+
<h2>Task Lists</h2>
|
383 |
+
<label for="task-items">Tasks (one per line):</label>
|
384 |
+
<textarea id="task-items" placeholder="e.g., [x] Task 1"></textarea>
|
385 |
+
<button id="insert-tasks">Insert Tasks</button>
|
386 |
+
</div>
|
387 |
+
</div>
|
388 |
+
|
389 |
+
<!-- Horizontal Rule Modal -->
|
390 |
+
<div class="modal" id="hr-modal">
|
391 |
+
<div class="modal-content">
|
392 |
+
<h2>Horizontal Rule</h2>
|
393 |
+
<p>Insert a horizontal rule:</p>
|
394 |
+
<button id="insert-hr">Insert Horizontal Rule</button>
|
395 |
+
</div>
|
396 |
+
</div>
|
397 |
+
|
398 |
+
<!-- Emojis Modal -->
|
399 |
+
<div class="modal" id="emoji-modal">
|
400 |
+
<div class="modal-content">
|
401 |
+
<h2>Emojis</h2>
|
402 |
+
<label for="emoji">Select an Emoji:</label>
|
403 |
+
<select id="emoji">
|
404 |
+
<option value="π">π Grinning Face</option>
|
405 |
+
<option value="π">π Rocket</option>
|
406 |
+
<option value="β€οΈ">β€οΈ Heart</option>
|
407 |
+
<option value="π">π Star</option>
|
408 |
+
<option value="π₯">π₯ Fire</option>
|
409 |
+
</select>
|
410 |
+
<button id="insert-emoji">Insert Emoji</button>
|
411 |
+
</div>
|
412 |
+
</div>
|
413 |
+
|
414 |
+
<!-- Mentions Modal -->
|
415 |
+
<div class="modal" id="mention-modal">
|
416 |
+
<div class="modal-content">
|
417 |
+
<h2>Mentions</h2>
|
418 |
+
<label for="mention-username">Username:</label>
|
419 |
+
<input type="text" id="mention-username" placeholder="e.g., octocat">
|
420 |
+
<button id="insert-mention">Insert Mention</button>
|
421 |
+
</div>
|
422 |
+
</div>
|
423 |
+
|
424 |
+
<!-- Marked.js for Markdown parsing -->
|
425 |
+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
426 |
+
<script>
|
427 |
+
const input = document.getElementById('markdown-input');
|
428 |
+
const preview = document.getElementById('markdown-preview');
|
429 |
+
const commandSelect = document.getElementById('command-select');
|
430 |
+
|
431 |
+
// Function to update the Markdown preview
|
432 |
+
function updatePreview() {
|
433 |
+
const markdownText = input.value;
|
434 |
+
preview.innerHTML = marked.parse(markdownText);
|
435 |
+
}
|
436 |
+
|
437 |
+
// Function to show a modal
|
438 |
+
function showModal(modalId) {
|
439 |
+
const modal = document.getElementById(modalId);
|
440 |
+
modal.style.display = 'flex';
|
441 |
+
}
|
442 |
+
|
443 |
+
// Function to hide a modal
|
444 |
+
function hideModal(modalId) {
|
445 |
+
const modal = document.getElementById(modalId);
|
446 |
+
modal.style.display = 'none';
|
447 |
+
}
|
448 |
+
|
449 |
+
// Function to insert a badge
|
450 |
+
function insertBadge() {
|
451 |
+
const label = document.getElementById('badge-label').value || 'label';
|
452 |
+
const message = document.getElementById('badge-message').value || 'message';
|
453 |
+
const color = document.getElementById('badge-color').value || 'blue';
|
454 |
+
const icon = document.getElementById('badge-icon').value;
|
455 |
+
|
456 |
+
let badgeUrl = `https://img.shields.io/badge/${encodeURIComponent(label)}-${encodeURIComponent(message)}-${color}`;
|
457 |
+
if (icon) {
|
458 |
+
badgeUrl += `?logo=${icon}`;
|
459 |
+
}
|
460 |
+
|
461 |
+
const badgeMarkdown = ``;
|
462 |
+
|
463 |
+
input.value += `\n${badgeMarkdown}`;
|
464 |
+
updatePreview();
|
465 |
+
hideModal('badge-modal');
|
466 |
+
}
|
467 |
+
|
468 |
+
// Function to insert a link
|
469 |
+
function insertLink() {
|
470 |
+
const text = document.getElementById('link-text').value || 'Link';
|
471 |
+
const url = document.getElementById('link-url').value || '#';
|
472 |
+
const linkMarkdown = `[${text}](${url})`;
|
473 |
+
|
474 |
+
input.value += `\n${linkMarkdown}`;
|
475 |
+
updatePreview();
|
476 |
+
hideModal('links-modal');
|
477 |
+
}
|
478 |
+
|
479 |
+
// Function to insert an image
|
480 |
+
function insertImage() {
|
481 |
+
const url = document.getElementById('image-url').value || '#';
|
482 |
+
const imageMarkdown = ``;
|
483 |
+
|
484 |
+
input.value += `\n${imageMarkdown}`;
|
485 |
+
updatePreview();
|
486 |
+
hideModal('links-modal');
|
487 |
+
}
|
488 |
+
|
489 |
+
// Function to insert a block
|
490 |
+
function insertBlock() {
|
491 |
+
const type = document.getElementById('block-type').value;
|
492 |
+
const content = document.getElementById('block-content').value;
|
493 |
+
|
494 |
+
let blockMarkdown = '';
|
495 |
+
if (type === 'code') {
|
496 |
+
blockMarkdown = `\`\`\`\n${content}\n\`\`\``;
|
497 |
+
} else if (type === 'quote') {
|
498 |
+
blockMarkdown = `> ${content}`;
|
499 |
+
}
|
500 |
+
|
501 |
+
input.value += `\n${blockMarkdown}`;
|
502 |
+
updatePreview();
|
503 |
+
hideModal('blocks-modal');
|
504 |
+
}
|
505 |
+
|
506 |
+
// Function to insert a list
|
507 |
+
function insertList() {
|
508 |
+
const type = document.getElementById('list-type').value;
|
509 |
+
const items = document.getElementById('list-items').value.split('\n').filter(item => item.trim() !== '');
|
510 |
+
|
511 |
+
let listMarkdown = '';
|
512 |
+
if (type === 'unordered') {
|
513 |
+
listMarkdown = items.map(item => `- ${item}`).join('\n');
|
514 |
+
} else if (type === 'ordered') {
|
515 |
+
listMarkdown = items.map((item, index) => `${index + 1}. ${item}`).join('\n');
|
516 |
+
}
|
517 |
+
|
518 |
+
input.value += `\n${listMarkdown}`;
|
519 |
+
updatePreview();
|
520 |
+
hideModal('lists-modal');
|
521 |
+
}
|
522 |
+
|
523 |
+
// Function to insert a heading
|
524 |
+
function insertHeading() {
|
525 |
+
const level = document.getElementById('heading-level').value;
|
526 |
+
const text = document.getElementById('heading-text').value || 'Heading';
|
527 |
+
|
528 |
+
const headingMarkdown = `${'#'.repeat(level)} ${text}`;
|
529 |
+
|
530 |
+
input.value += `\n${headingMarkdown}`;
|
531 |
+
updatePreview();
|
532 |
+
hideModal('headings-modal');
|
533 |
+
}
|
534 |
+
|
535 |
+
// Function to insert formatted text
|
536 |
+
function insertText() {
|
537 |
+
const content = document.getElementById('text-content').value || 'Text';
|
538 |
+
const format = document.getElementById('text-format').value;
|
539 |
+
|
540 |
+
let formattedText = '';
|
541 |
+
if (format === 'bold') {
|
542 |
+
formattedText = `**${content}**`;
|
543 |
+
} else if (format === 'italic') {
|
544 |
+
formattedText = `*${content}*`;
|
545 |
+
} else if (format === 'strikethrough') {
|
546 |
+
formattedText = `~~${content}~~`;
|
547 |
+
} else if (format === 'inline-code') {
|
548 |
+
formattedText = `\`${content}\``;
|
549 |
+
}
|
550 |
+
|
551 |
+
input.value += `\n${formattedText}`;
|
552 |
+
updatePreview();
|
553 |
+
hideModal('text-modal');
|
554 |
+
}
|
555 |
+
|
556 |
+
// Function to insert a table
|
557 |
+
function insertTable() {
|
558 |
+
const headers = document.getElementById('table-headers').value.split(',').map(header => header.trim());
|
559 |
+
const rows = document.getElementById('table-rows').value.split('\n').map(row => row.split(',').map(cell => cell.trim()));
|
560 |
+
|
561 |
+
let tableMarkdown = `| ${headers.join(' | ')} |\n`;
|
562 |
+
tableMarkdown += `| ${headers.map(() => '---').join(' | ')} |\n`;
|
563 |
+
rows.forEach(row => {
|
564 |
+
tableMarkdown += `| ${row.join(' | ')} |\n`;
|
565 |
+
});
|
566 |
+
|
567 |
+
input.value += `\n${tableMarkdown}`;
|
568 |
+
updatePreview();
|
569 |
+
hideModal('tables-modal');
|
570 |
+
}
|
571 |
+
|
572 |
+
// Function to insert task lists
|
573 |
+
function insertTasks() {
|
574 |
+
const tasks = document.getElementById('task-items').value.split('\n').filter(task => task.trim() !== '');
|
575 |
+
|
576 |
+
const tasksMarkdown = tasks.map(task => `- ${task}`).join('\n');
|
577 |
+
|
578 |
+
input.value +
|