<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Markdown 文件</title>
<style>
/* 这里添加您的样式表代码 */
</style>
</head>
<body>
<div id="markdown-container"></div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
//填写自己的路径,需要部署在服务器上
const markdownUrl = './example.md'; // Markdown 文件的 URL
const markdownContainer = document.getElementById('markdown-container');
fetch(markdownUrl)
.then(response => response.text())
.then(markdown => {
const html = marked.parse(markdown);
markdownContainer.innerHTML = html;
})
.catch(err => console.error(err));
</script>
</body>
</html>
服务器上解析md
最新推荐文章于 2024-02-04 23:22:13 发布