Spaces:
Running
Running
Chỗ này đâu có dùng react-markdown đâu - Follow Up Deployment
Browse files- index.html +5 -21
- prompts.txt +6 -1
index.html
CHANGED
|
@@ -6,9 +6,9 @@
|
|
| 6 |
<title>JSON Markdown Renderer</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/github.min.css">
|
| 9 |
-
<script src="https://
|
| 10 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
|
| 11 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
|
|
|
|
| 12 |
|
| 13 |
<style>
|
| 14 |
.markdown-body {
|
|
@@ -106,14 +106,6 @@
|
|
| 106 |
|
| 107 |
<script>
|
| 108 |
document.addEventListener('DOMContentLoaded', function() {
|
| 109 |
-
// Initialize showdown markdown converter with GitHub flavor
|
| 110 |
-
const converter = new showdown.Converter({
|
| 111 |
-
tables: true,
|
| 112 |
-
strikethrough: true,
|
| 113 |
-
tasklists: true,
|
| 114 |
-
emoji: true,
|
| 115 |
-
openLinksInNewWindow: true
|
| 116 |
-
});
|
| 117 |
|
| 118 |
// Get DOM elements
|
| 119 |
const dropzone = document.getElementById('dropzone');
|
|
@@ -180,9 +172,7 @@
|
|
| 180 |
});
|
| 181 |
|
| 182 |
// Handle sample button
|
| 183 |
-
sampleBtn.addEventListener('click',
|
| 184 |
-
renderSample();
|
| 185 |
-
});
|
| 186 |
|
| 187 |
// Process uploaded files
|
| 188 |
function handleFiles(files) {
|
|
@@ -226,17 +216,11 @@
|
|
| 226 |
// Show loading state
|
| 227 |
markdownContent.innerHTML = '<div class="text-center py-8"><i class="fas fa-spinner fa-spin text-3xl text-blue-500"></i><p class="mt-4 text-gray-600">Rendering markdown...</p></div>';
|
| 228 |
|
| 229 |
-
//
|
|
|
|
| 230 |
const html = converter.makeHtml(markdownText);
|
| 231 |
-
|
| 232 |
-
// Display the result
|
| 233 |
markdownContent.innerHTML = html;
|
| 234 |
|
| 235 |
-
// Highlight any code blocks
|
| 236 |
-
document.querySelectorAll('pre code').forEach((block) => {
|
| 237 |
-
hljs.highlightElement(block);
|
| 238 |
-
});
|
| 239 |
-
|
| 240 |
// Switch to result view
|
| 241 |
uploadContainer.classList.add('hidden');
|
| 242 |
resultContainer.classList.remove('hidden');
|
|
|
|
| 6 |
<title>JSON Markdown Renderer</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/github.min.css">
|
| 9 |
+
<script src="https://unpkg.com/highlight.js@11.7.0/lib/core.min.js"></script>
|
|
|
|
| 10 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js"></script>
|
| 11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
|
| 12 |
|
| 13 |
<style>
|
| 14 |
.markdown-body {
|
|
|
|
| 106 |
|
| 107 |
<script>
|
| 108 |
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
// Get DOM elements
|
| 111 |
const dropzone = document.getElementById('dropzone');
|
|
|
|
| 172 |
});
|
| 173 |
|
| 174 |
// Handle sample button
|
| 175 |
+
sampleBtn.addEventListener('click', renderSample);
|
|
|
|
|
|
|
| 176 |
|
| 177 |
// Process uploaded files
|
| 178 |
function handleFiles(files) {
|
|
|
|
| 216 |
// Show loading state
|
| 217 |
markdownContent.innerHTML = '<div class="text-center py-8"><i class="fas fa-spinner fa-spin text-3xl text-blue-500"></i><p class="mt-4 text-gray-600">Rendering markdown...</p></div>';
|
| 218 |
|
| 219 |
+
// Process markdown with Showdown.js
|
| 220 |
+
const converter = new showdown.Converter();
|
| 221 |
const html = converter.makeHtml(markdownText);
|
|
|
|
|
|
|
| 222 |
markdownContent.innerHTML = html;
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
// Switch to result view
|
| 225 |
uploadContainer.classList.add('hidden');
|
| 226 |
resultContainer.classList.remove('hidden');
|
prompts.txt
CHANGED
|
@@ -1,4 +1,9 @@
|
|
| 1 |
Tôi cần một trang có thể hiển thị markdown bằng react-markdown
|
| 2 |
Vẫn chưa được, hiện tại nó không display markdown khi tôi gõ vào Editor
|
| 3 |
Vậy chưa sử đụng dược
|
| 4 |
-
Tôi cần tạo ra html và js có thể render được markdown từ 1 file Json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
Tôi cần một trang có thể hiển thị markdown bằng react-markdown
|
| 2 |
Vẫn chưa được, hiện tại nó không display markdown khi tôi gõ vào Editor
|
| 3 |
Vậy chưa sử đụng dược
|
| 4 |
+
Tôi cần tạo ra html và js có thể render được markdown từ 1 file Json
|
| 5 |
+
Tôi có thể sử dụng react-mark down được không
|
| 6 |
+
Lỗi rồi showdown is not defined at HTMLDocument.<anonymous> (VM93 about:srcdoc:4:31)
|
| 7 |
+
Lỗi rồi Uncaught SyntaxError: Unexpected token '<' (at VM114 about:srcdoc:123:37)
|
| 8 |
+
Tôi nhấn load example Json không được
|
| 9 |
+
Chỗ này đâu có dùng react-markdown đâu
|