Skip to content

Commit 612464b

Browse files
committed
1
1 parent e55b90f commit 612464b

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

web/markdown/page.html

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
<script type="text/javascript" src="../mainmenu.js"></script>
1313
<script type="text/javascript" src="./page.js"></script>
1414

15-
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
16-
15+
<!-- marked -->
16+
<!--
17+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
18+
-->
19+
20+
<!-- showdown -->
21+
<script src="https://cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js"></script>
22+
1723
</head>
1824
<body>
1925
<div id="contents">
@@ -25,13 +31,21 @@
2531
<script>
2632

2733
function renderMarkdwon(markdown_view_id, markdown_url) {
28-
var xmlhttp = new XMLHttpRequest();
29-
xmlhttp.onreadystatechange =
30-
function () {
31-
if (this.readyState == 4 && this.status == 200) {
32-
const html = marked.parse(this.responseText);
33-
document.getElementById(markdown_view_id).innerHTML = html;
34-
}
34+
var xmlhttp = new XMLHttpRequest();
35+
xmlhttp.onreadystatechange =
36+
function () {
37+
if (this.readyState == 4 && this.status == 200) {
38+
39+
//marked
40+
//const html = marked.parse(this.responseText); // marked
41+
42+
// showdown
43+
const converter = new showdown.Converter();
44+
const html = converter.makeHtml(markdown);
45+
46+
document.getElementById(markdown_view_id).innerHTML = html;
47+
48+
}
3549
};
3650

3751
xmlhttp.open("GET", markdown_url, true);

0 commit comments

Comments
 (0)