Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Markdown Preview</title> | |
<!-- Link to Google Fonts to use Poppins --> | |
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> | |
<!-- Styling for the page --> | |
<style> | |
body { | |
font-family: 'Poppins', sans-serif; | |
line-height: 1.6; | |
padding: 20px; | |
max-width: 800px; | |
margin: auto; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
font-weight: 600; | |
} | |
p { | |
margin-bottom: 1em; | |
} | |
pre { | |
background-color: #f4f4f4; | |
padding: 10px; | |
border-radius: 5px; | |
overflow-x: auto; | |
} | |
code { | |
background-color: #f4f4f4; | |
padding: 2px 4px; | |
border-radius: 3px; | |
} | |
blockquote { | |
border-left: 5px solid #ccc; | |
padding-left: 10px; | |
color: #666; | |
margin-left: 0; | |
} | |
ul, ol { | |
margin-left: 20px; | |
} | |
a { | |
color: #007bff; | |
text-decoration: none; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Markdown Preview</h1> | |
<div id="markdown-content"> | |
<!-- Markdown content will be rendered here --> | |
</div> | |
<!-- Include the Marked.js library --> | |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> | |
<!-- Script to fetch and render Markdown file --> | |
<script> | |
async function loadMarkdown() { | |
const response = await fetch('example.md'); | |
const markdown = await response.text(); | |
// Render the markdown using marked.js | |
const htmlContent = marked(markdown); | |
document.getElementById('markdown-content').innerHTML = htmlContent; | |
} | |
loadMarkdown(); | |
</script> | |
</body> | |
</html> | |