forked from TingjiaInFuture/allbemcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
32 lines (30 loc) · 1.06 KB
/
Copy pathdemo.html
File metadata and controls
32 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<title>AllBeAPI 演示</title>
<script src="SDK/JavaScript/allbeapi.js"></script>
</head>
<body>
<h1>AllBeAPI 演示</h1>
<textarea id="markdown" placeholder="输入 markdown..." rows="5" cols="50"># 你好 AllBeAPI
这真是 **太棒了**!</textarea>
<br>
<button onclick="convert()">转换为 HTML</button>
<h3>结果:</h3>
<div id="result" style="border: 1px solid #ccc; padding: 10px; min-height: 50px;"></div>
<script>
const api = new AllBeApi();
async function convert() {
const markdownInput = document.getElementById('markdown').value;
const resultDiv = document.getElementById('result');
try {
const response = await api.marked.render(markdownInput);
resultDiv.innerHTML = response; // Changed from response.html
} catch (error) {
resultDiv.innerText = '错误: ' + error.message;
console.error('错误:', error);
}
}
</script>
</body>
</html>