Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +439 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
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: mdtotex
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: gray
|
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,439 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 to Fancy LaTeX Converter</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<style>
|
10 |
+
.markdown-preview, .latex-output {
|
11 |
+
min-height: 300px;
|
12 |
+
max-height: 500px;
|
13 |
+
overflow-y: auto;
|
14 |
+
}
|
15 |
+
|
16 |
+
.markdown-preview {
|
17 |
+
border-right: 1px solid #e5e7eb;
|
18 |
+
}
|
19 |
+
|
20 |
+
@media (max-width: 768px) {
|
21 |
+
.markdown-preview {
|
22 |
+
border-right: none;
|
23 |
+
border-bottom: 1px solid #e5e7eb;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/* Syntax highlighting for markdown preview */
|
28 |
+
.markdown-preview h1 {
|
29 |
+
@apply text-2xl font-bold mb-4 text-blue-600;
|
30 |
+
}
|
31 |
+
|
32 |
+
.markdown-preview h2 {
|
33 |
+
@apply text-xl font-bold mb-3 text-blue-500;
|
34 |
+
}
|
35 |
+
|
36 |
+
.markdown-preview h3 {
|
37 |
+
@apply text-lg font-bold mb-2 text-blue-400;
|
38 |
+
}
|
39 |
+
|
40 |
+
.markdown-preview p {
|
41 |
+
@apply mb-4 text-gray-700;
|
42 |
+
}
|
43 |
+
|
44 |
+
.markdown-preview code {
|
45 |
+
@apply bg-gray-100 px-2 py-1 rounded text-sm font-mono text-pink-600;
|
46 |
+
}
|
47 |
+
|
48 |
+
.markdown-preview pre {
|
49 |
+
@apply bg-gray-800 text-gray-100 p-4 rounded mb-4 overflow-x-auto;
|
50 |
+
}
|
51 |
+
|
52 |
+
.markdown-preview blockquote {
|
53 |
+
@apply border-l-4 border-gray-400 pl-4 italic text-gray-600;
|
54 |
+
}
|
55 |
+
|
56 |
+
.markdown-preview ul, .markdown-preview ol {
|
57 |
+
@apply pl-8 mb-4;
|
58 |
+
}
|
59 |
+
|
60 |
+
.markdown-preview ul {
|
61 |
+
@apply list-disc;
|
62 |
+
}
|
63 |
+
|
64 |
+
.markdown-preview ol {
|
65 |
+
@apply list-decimal;
|
66 |
+
}
|
67 |
+
|
68 |
+
/* Animation for conversion */
|
69 |
+
@keyframes pulse {
|
70 |
+
0%, 100% {
|
71 |
+
opacity: 1;
|
72 |
+
}
|
73 |
+
50% {
|
74 |
+
opacity: 0.5;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
.converting {
|
79 |
+
animation: pulse 1.5s infinite;
|
80 |
+
}
|
81 |
+
</style>
|
82 |
+
</head>
|
83 |
+
<body class="bg-gray-50 min-h-screen">
|
84 |
+
<div class="container mx-auto px-4 py-8">
|
85 |
+
<!-- Header -->
|
86 |
+
<header class="mb-8 text-center">
|
87 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-2">
|
88 |
+
<i class="fas fa-code text-blue-500 mr-2"></i>
|
89 |
+
Markdown to Fancy LaTeX
|
90 |
+
</h1>
|
91 |
+
<p class="text-gray-600 max-w-2xl mx-auto">
|
92 |
+
Convert your Markdown documents to beautifully formatted LaTeX with this interactive tool.
|
93 |
+
See live previews and customize the output.
|
94 |
+
</p>
|
95 |
+
</header>
|
96 |
+
|
97 |
+
<!-- Main Content -->
|
98 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
|
99 |
+
<!-- Toolbar -->
|
100 |
+
<div class="bg-gray-800 text-white px-4 py-3 flex flex-wrap items-center justify-between">
|
101 |
+
<div class="flex items-center space-x-2 mb-2 sm:mb-0">
|
102 |
+
<span class="font-medium">
|
103 |
+
<i class="fas fa-tools mr-1"></i> Tools
|
104 |
+
</span>
|
105 |
+
<button onclick="insertText('# ', 'markdown-input')" class="bg-blue-600 hover:bg-blue-700 px-3 py-1 rounded text-sm">
|
106 |
+
<i class="fas fa-heading mr-1"></i> H1
|
107 |
+
</button>
|
108 |
+
<button onclick="insertText('## ', 'markdown-input')" class="bg-blue-600 hover:bg-blue-700 px-3 py-1 rounded text-sm">
|
109 |
+
<i class="fas fa-heading mr-1"></i> H2
|
110 |
+
</button>
|
111 |
+
<button onclick="insertText('**bold**', 'markdown-input')" class="bg-blue-600 hover:bg-blue-700 px-3 py-1 rounded text-sm">
|
112 |
+
<i class="fas fa-bold mr-1"></i> Bold
|
113 |
+
</button>
|
114 |
+
<button onclick="insertText('*italic*', 'markdown-input')" class="bg-blue-600 hover:bg-blue-700 px-3 py-1 rounded text-sm">
|
115 |
+
<i class="fas fa-italic mr-1"></i> Italic
|
116 |
+
</button>
|
117 |
+
</div>
|
118 |
+
<div class="flex items-center space-x-2">
|
119 |
+
<button onclick="convertMarkdown()" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded font-medium">
|
120 |
+
<i class="fas fa-exchange-alt mr-2"></i> Convert
|
121 |
+
</button>
|
122 |
+
<button onclick="copyToClipboard('latex-output')" class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded font-medium">
|
123 |
+
<i class="fas fa-copy mr-2"></i> Copy LaTeX
|
124 |
+
</button>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
|
128 |
+
<!-- Editor and Preview Panes -->
|
129 |
+
<div class="grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-gray-200">
|
130 |
+
<!-- Markdown Input -->
|
131 |
+
<div class="p-4">
|
132 |
+
<div class="flex justify-between items-center mb-2">
|
133 |
+
<h3 class="font-medium text-gray-700">
|
134 |
+
<i class="fas fa-edit text-blue-500 mr-2"></i> Markdown Input
|
135 |
+
</h3>
|
136 |
+
<button onclick="clearEditor()" class="text-red-500 hover:text-red-700 text-sm">
|
137 |
+
<i class="fas fa-trash-alt mr-1"></i> Clear
|
138 |
+
</button>
|
139 |
+
</div>
|
140 |
+
<textarea id="markdown-input" class="w-full h-64 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono" placeholder="Write your Markdown here..."># Sample Document
|
141 |
+
|
142 |
+
This is a **Markdown** to *LaTeX* converter.
|
143 |
+
|
144 |
+
## Features
|
145 |
+
|
146 |
+
- Live preview
|
147 |
+
- Easy formatting tools
|
148 |
+
- Clean LaTeX output
|
149 |
+
|
150 |
+
```python
|
151 |
+
def hello_world():
|
152 |
+
print("Hello, LaTeX!")
|
153 |
+
```
|
154 |
+
|
155 |
+
> Blockquotes are supported too!</textarea>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
<!-- Markdown Preview -->
|
159 |
+
<div class="p-4 markdown-preview">
|
160 |
+
<h3 class="font-medium text-gray-700 mb-2">
|
161 |
+
<i class="fas fa-eye text-green-500 mr-2"></i> Markdown Preview
|
162 |
+
</h3>
|
163 |
+
<div id="markdown-preview" class="prose max-w-none"></div>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
|
167 |
+
<!-- LaTeX Output -->
|
168 |
+
<div class="border-t border-gray-200 p-4">
|
169 |
+
<div class="flex justify-between items-center mb-2">
|
170 |
+
<h3 class="font-medium text-gray-700">
|
171 |
+
<i class="fas fa-file-alt text-purple-500 mr-2"></i> LaTeX Output
|
172 |
+
</h3>
|
173 |
+
<div id="converting-indicator" class="hidden text-sm text-gray-500 converting">
|
174 |
+
<i class="fas fa-spinner fa-spin mr-1"></i> Converting...
|
175 |
+
</div>
|
176 |
+
</div>
|
177 |
+
<pre id="latex-output" class="latex-output w-full p-4 bg-gray-100 rounded-lg font-mono text-sm overflow-x-auto"></pre>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
|
181 |
+
<!-- Examples Section -->
|
182 |
+
<div class="mt-12 bg-white rounded-xl shadow-lg overflow-hidden">
|
183 |
+
<div class="bg-gray-100 px-4 py-3 border-b border-gray-200">
|
184 |
+
<h3 class="font-medium text-gray-800">
|
185 |
+
<i class="fas fa-lightbulb text-yellow-500 mr-2"></i> Markdown Examples
|
186 |
+
</h3>
|
187 |
+
</div>
|
188 |
+
<div class="p-4 grid grid-cols-1 md:grid-cols-3 gap-4">
|
189 |
+
<div class="border border-gray-200 rounded-lg p-3 hover:shadow-md transition-shadow cursor-pointer" onclick="loadExample('basic')">
|
190 |
+
<h4 class="font-medium text-blue-600 mb-2">Basic Document</h4>
|
191 |
+
<p class="text-sm text-gray-600">Headers, paragraphs, and basic formatting.</p>
|
192 |
+
</div>
|
193 |
+
<div class="border border-gray-200 rounded-lg p-3 hover:shadow-md transition-shadow cursor-pointer" onclick="loadExample('math')">
|
194 |
+
<h4 class="font-medium text-blue-600 mb-2">Math Equations</h4>
|
195 |
+
<p class="text-sm text-gray-600">Inline and block mathematical expressions.</p>
|
196 |
+
</div>
|
197 |
+
<div class="border border-gray-200 rounded-lg p-3 hover:shadow-md transition-shadow cursor-pointer" onclick="loadExample('table')">
|
198 |
+
<h4 class="font-medium text-blue-600 mb-2">Tables</h4>
|
199 |
+
<p class="text-sm text-gray-600">Simple and complex table structures.</p>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
|
205 |
+
<script>
|
206 |
+
// Initialize the page
|
207 |
+
document.addEventListener('DOMContentLoaded', function() {
|
208 |
+
updateMarkdownPreview();
|
209 |
+
convertMarkdown();
|
210 |
+
});
|
211 |
+
|
212 |
+
// Update markdown preview in real-time
|
213 |
+
document.getElementById('markdown-input').addEventListener('input', function() {
|
214 |
+
updateMarkdownPreview();
|
215 |
+
});
|
216 |
+
|
217 |
+
// Convert markdown to LaTeX
|
218 |
+
function convertMarkdown() {
|
219 |
+
const markdown = document.getElementById('markdown-input').value;
|
220 |
+
const latexOutput = document.getElementById('latex-output');
|
221 |
+
const convertingIndicator = document.getElementById('converting-indicator');
|
222 |
+
|
223 |
+
// Show converting indicator
|
224 |
+
convertingIndicator.classList.remove('hidden');
|
225 |
+
latexOutput.textContent = '';
|
226 |
+
|
227 |
+
// Simulate processing delay for better UX
|
228 |
+
setTimeout(() => {
|
229 |
+
// Simple markdown to LaTeX conversion
|
230 |
+
let latex = markdown
|
231 |
+
// Headers
|
232 |
+
.replace(/^# (.*$)/gm, '\\section{$1}')
|
233 |
+
.replace(/^## (.*$)/gm, '\\subsection{$1}')
|
234 |
+
.replace(/^### (.*$)/gm, '\\subsubsection{$1}')
|
235 |
+
|
236 |
+
// Bold and italic
|
237 |
+
.replace(/\*\*(.*?)\*\*/g, '\\textbf{$1}')
|
238 |
+
.replace(/\*(.*?)\*/g, '\\textit{$1}')
|
239 |
+
.replace(/_(.*?)_/g, '\\textit{$1}')
|
240 |
+
|
241 |
+
// Code blocks
|
242 |
+
.replace(/```([a-z]*)\n([\s\S]*?)\n```/g, function(match, lang, code) {
|
243 |
+
return '\\begin{lstlisting}[language=' + (lang || 'text') + ']\n' + code + '\n\\end{lstlisting}';
|
244 |
+
})
|
245 |
+
.replace(/`([^`]+)`/g, '\\texttt{$1}')
|
246 |
+
|
247 |
+
// Lists
|
248 |
+
.replace(/^\s*\*\s(.*$)/gm, '\\item $1')
|
249 |
+
.replace(/^(\s*)\*\s(.*$)/gm, function(match, spaces, content) {
|
250 |
+
const depth = spaces.length / 2;
|
251 |
+
return '\\item'.repeat(depth) + ' ' + content;
|
252 |
+
})
|
253 |
+
.replace(/^([\s\S]*?)(?=\n\n)/gm, function(match) {
|
254 |
+
if (match.trim().startsWith('\\item')) {
|
255 |
+
return '\\begin{itemize}\n' + match + '\n\\end{itemize}';
|
256 |
+
}
|
257 |
+
return match;
|
258 |
+
})
|
259 |
+
|
260 |
+
// Blockquotes
|
261 |
+
.replace(/^>\s(.*$)/gm, '\\begin{quote}\n$1\n\\end{quote}')
|
262 |
+
|
263 |
+
// Horizontal rule
|
264 |
+
.replace(/^[-*]{3,}$/gm, '\\hrulefill')
|
265 |
+
|
266 |
+
// Links and images
|
267 |
+
.replace(/!\[(.*?)\]\((.*?)\)/g, '\\includegraphics{$2}')
|
268 |
+
.replace(/\[(.*?)\]\((.*?)\)/g, '\\href{$2}{$1}');
|
269 |
+
|
270 |
+
// Add document structure
|
271 |
+
latex = `\\documentclass{article}
|
272 |
+
\\usepackage{hyperref}
|
273 |
+
\\usepackage{listings}
|
274 |
+
\\usepackage{graphicx}
|
275 |
+
|
276 |
+
\\begin{document}
|
277 |
+
|
278 |
+
${latex}
|
279 |
+
|
280 |
+
\\end{document}`;
|
281 |
+
|
282 |
+
latexOutput.textContent = latex;
|
283 |
+
convertingIndicator.classList.add('hidden');
|
284 |
+
|
285 |
+
// Highlight LaTeX syntax
|
286 |
+
highlightLatexSyntax();
|
287 |
+
}, 800);
|
288 |
+
}
|
289 |
+
|
290 |
+
// Update markdown preview
|
291 |
+
function updateMarkdownPreview() {
|
292 |
+
const markdown = document.getElementById('markdown-input').value;
|
293 |
+
const preview = document.getElementById('markdown-preview');
|
294 |
+
|
295 |
+
// Simple markdown to HTML conversion for preview
|
296 |
+
let html = markdown
|
297 |
+
.replace(/^# (.*$)/gm, '<h1>$1</h1>')
|
298 |
+
.replace(/^## (.*$)/gm, '<h2>$1</h2>')
|
299 |
+
.replace(/^### (.*$)/gm, '<h3>$1</h3>')
|
300 |
+
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
|
301 |
+
.replace(/\*(.*?)\*/g, '<em>$1</em>')
|
302 |
+
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
303 |
+
.replace(/```([a-z]*)\n([\s\S]*?)\n```/g, '<pre><code class="$1">$2</code></pre>')
|
304 |
+
.replace(/^\s*\*\s(.*$)/gm, '<li>$1</li>')
|
305 |
+
.replace(/^>\s(.*$)/gm, '<blockquote>$1</blockquote>')
|
306 |
+
.replace(/\n\n/g, '<br><br>')
|
307 |
+
.replace(/\n/g, '<br>');
|
308 |
+
|
309 |
+
preview.innerHTML = html;
|
310 |
+
}
|
311 |
+
|
312 |
+
// Insert text at cursor position
|
313 |
+
function insertText(text, elementId) {
|
314 |
+
const textarea = document.getElementById(elementId);
|
315 |
+
const startPos = textarea.selectionStart;
|
316 |
+
const endPos = textarea.selectionEnd;
|
317 |
+
const currentText = textarea.value;
|
318 |
+
|
319 |
+
textarea.value = currentText.substring(0, startPos) + text + currentText.substring(endPos);
|
320 |
+
textarea.selectionStart = textarea.selectionEnd = startPos + text.length;
|
321 |
+
textarea.focus();
|
322 |
+
|
323 |
+
updateMarkdownPreview();
|
324 |
+
}
|
325 |
+
|
326 |
+
// Copy LaTeX to clipboard
|
327 |
+
function copyToClipboard(elementId) {
|
328 |
+
const element = document.getElementById(elementId);
|
329 |
+
const text = element.textContent;
|
330 |
+
|
331 |
+
navigator.clipboard.writeText(text).then(() => {
|
332 |
+
// Show success feedback
|
333 |
+
const originalText = element.textContent;
|
334 |
+
element.textContent = 'Copied to clipboard!';
|
335 |
+
element.classList.add('text-green-600');
|
336 |
+
|
337 |
+
setTimeout(() => {
|
338 |
+
element.textContent = originalText;
|
339 |
+
element.classList.remove('text-green-600');
|
340 |
+
}, 2000);
|
341 |
+
}).catch(err => {
|
342 |
+
console.error('Failed to copy: ', err);
|
343 |
+
});
|
344 |
+
}
|
345 |
+
|
346 |
+
// Clear the editor
|
347 |
+
function clearEditor() {
|
348 |
+
if (confirm('Are you sure you want to clear the editor?')) {
|
349 |
+
document.getElementById('markdown-input').value = '';
|
350 |
+
document.getElementById('markdown-preview').innerHTML = '';
|
351 |
+
document.getElementById('latex-output').textContent = '';
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
// Load example markdown
|
356 |
+
function loadExample(type) {
|
357 |
+
let example = '';
|
358 |
+
|
359 |
+
switch(type) {
|
360 |
+
case 'basic':
|
361 |
+
example = `# Introduction
|
362 |
+
|
363 |
+
This is a **basic** Markdown document that demonstrates *common* formatting.
|
364 |
+
|
365 |
+
## Features
|
366 |
+
|
367 |
+
- Headers
|
368 |
+
- Emphasis (bold, italic)
|
369 |
+
- Lists
|
370 |
+
- Code blocks
|
371 |
+
|
372 |
+
\`\`\`python
|
373 |
+
def greet(name):
|
374 |
+
print(f"Hello, {name}!")
|
375 |
+
\`\`\`
|
376 |
+
|
377 |
+
> This is a blockquote demonstrating how quoted text appears.`;
|
378 |
+
break;
|
379 |
+
|
380 |
+
case 'math':
|
381 |
+
example = `# Mathematical Expressions
|
382 |
+
|
383 |
+
Inline math: $E = mc^2$
|
384 |
+
|
385 |
+
Display math:
|
386 |
+
|
387 |
+
$$
|
388 |
+
\\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}
|
389 |
+
$$
|
390 |
+
|
391 |
+
## Matrix Example
|
392 |
+
|
393 |
+
$$
|
394 |
+
\\begin{pmatrix}
|
395 |
+
1 & 2 & 3 \\\\
|
396 |
+
4 & 5 & 6 \\\\
|
397 |
+
7 & 8 & 9
|
398 |
+
\\end{pmatrix}
|
399 |
+
$$`;
|
400 |
+
break;
|
401 |
+
|
402 |
+
case 'table':
|
403 |
+
example = `# Tables in Markdown
|
404 |
+
|
405 |
+
| Syntax | Description | Test Text |
|
406 |
+
| :--- | :----: | ---: |
|
407 |
+
| Header | Title | Here's this |
|
408 |
+
| Paragraph | Text | And more |
|
409 |
+
|
410 |
+
## Complex Table
|
411 |
+
|
412 |
+
| Feature | Support |
|
413 |
+
| ------ | ------ |
|
414 |
+
| Tables | ✔️ |
|
415 |
+
| Alignment | ✔️ |
|
416 |
+
| Formatting | ✔️ |
|
417 |
+
| Multi-line | ✔️ |`;
|
418 |
+
break;
|
419 |
+
}
|
420 |
+
|
421 |
+
document.getElementById('markdown-input').value = example;
|
422 |
+
updateMarkdownPreview();
|
423 |
+
convertMarkdown();
|
424 |
+
}
|
425 |
+
|
426 |
+
// Simple LaTeX syntax highlighting
|
427 |
+
function highlightLatexSyntax() {
|
428 |
+
const latexOutput = document.getElementById('latex-output');
|
429 |
+
let html = latexOutput.textContent
|
430 |
+
.replace(/\\[a-zA-Z]+/g, '<span class="text-blue-600 font-bold">$&</span>')
|
431 |
+
.replace(/\{[^}]*\}/g, '<span class="text-green-600">$&</span>')
|
432 |
+
.replace(/\[[^\]]*\]/g, '<span class="text-purple-600">$&</span>')
|
433 |
+
.replace(/%[^\n]*/g, '<span class="text-gray-500 italic">$&</span>');
|
434 |
+
|
435 |
+
latexOutput.innerHTML = html;
|
436 |
+
}
|
437 |
+
</script>
|
438 |
+
<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=SherlockRamos/mdtotex" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
439 |
+
</html>
|