Spaces:
Running
on
Zero
Running
on
Zero
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>README.md Viewer</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
margin: 20px; | |
} | |
pre { | |
background-color: #f4f4f4; | |
padding: 10px; | |
border-radius: 5px; | |
overflow-x: auto; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>README.md Viewer</h1> | |
<div id="readme-content"></div> | |
<script> | |
// Function to fetch README.md content | |
async function fetchReadme() { | |
const response = await fetch('README.md'); | |
const content = await response.text(); | |
return content; | |
} | |
// Function to convert Markdown to HTML | |
function markdownToHtml(markdown) { | |
const converter = new showdown.Converter(); | |
return converter.makeHtml(markdown); | |
} | |
// Main function to display README content | |
async function displayReadme() { | |
const readmeContent = await fetchReadme(); | |
const readmeHtml = markdownToHtml(readmeContent); | |
document.getElementById('readme-content').innerHTML = readmeHtml; | |
} | |
// Call the main function | |
displayReadme(); | |
</script> | |
<!-- Include Showdown.js library for Markdown to HTML conversion --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script> | |
</body> | |
</html> | |