123456789101112131415161718192021222324252627 |
- <!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>
|