Toastie 9 months ago
parent
commit
94f029bda6
1 changed files with 27 additions and 0 deletions
  1. 27 0
      web/showdownjs.html

+ 27 - 0
web/showdownjs.html

@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Showdown.js Example</title>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script>
+  </head>
+  <body>
+    <div id="markdown-content"></div>
+    <script>
+      // Fetch your Markdown file (replace with your actual file URL)
+      fetch('./markdown-file.md')
+        .then(response => response.text())
+        .then(markdownText => {
+          // Create a Showdown converter
+          const converter = new showdown.Converter();
+          // Convert Markdown to HTML
+          const htmlContent = converter.makeHtml(markdownText);
+          // Display the HTML content
+          document.getElementById('markdown-content').innerHTML = htmlContent;
+        })
+        .catch(error => {
+          console.error('Error fetching Markdown:', error);
+        });
+    </script>
+  </body>
+</html>