// Function to convert Markdown to HTML
function convertMarkdownToHTML(markdownContent) {
// Simple Markdown to HTML conversion
// This is a basic example and may not cover all Markdown features
// You may need to enhance this function based on your requirements
return markdownContent
.replace(/\*\*(.*?)\*\*/g, '$1') // Bold
.replace(/\*(.*?)\*/g, '$1'); // Italics
}
// Function to fetch and display an article
function displayArticle(articlePath) {
fetch(articlePath)
.then(response => response.text())
.then(markdownContent => {
const htmlContent = convertMarkdownToHTML(markdownContent);
document.getElementById('article-container').innerHTML = htmlContent;
})
.catch(error => console.error('Error fetching article:', error));
}
// Call the function with the path to your Markdown file
displayArticle('/md/rants/test.md');