Skip to content

Commit a196b7f

Browse files
committed
use mark-down
1 parent e3cad76 commit a196b7f

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
22
<link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura.css" type="text/css">
3-
<script type="module" src="https://taisukef.github.io/marked_md/mark-down.js"></script>
3+
<script type="module" src="https://code4fukui.github.io/mark-down/mark-down.js"></script>
44
<style>
55
#language-selector {
66
position: fixed;

index.html

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
22
<link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura.css" type="text/css">
3-
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
3+
<script type="module" src="https://code4fukui.github.io/mark-down/mark-down.js"></script>
44
<style>
55
#language-selector {
66
position: fixed;
@@ -28,32 +28,21 @@
2828
<option value="en">English</option>
2929
</select>
3030
</div>
31-
<div id="content"></div>
31+
<mark-down id="content" src="index.md"></mark-down>
3232
<script>
33-
async function loadMarkdown(file) {
34-
try {
35-
const response = await fetch(file);
36-
const markdown = await response.text();
37-
document.getElementById('content').innerHTML = marked.parse(markdown);
38-
} catch (err) {
39-
console.error('Error loading markdown:', err);
40-
document.getElementById('content').innerHTML = '<p>Error loading content</p>';
41-
}
42-
}
43-
4433
function initLanguage() {
4534
const saved = localStorage.getItem('preferredLanguage') || 'ja';
4635
document.getElementById('lang-select').value = saved;
4736
document.documentElement.lang = saved;
4837
const file = saved === 'en' ? 'index-en.md' : 'index.md';
49-
loadMarkdown(file);
38+
content.src = file;
5039
}
5140

5241
function changeLanguage(lang) {
5342
localStorage.setItem('preferredLanguage', lang);
5443
document.documentElement.lang = lang;
5544
const file = lang === 'en' ? 'index-en.md' : 'index.md';
56-
loadMarkdown(file);
45+
content.src = file;
5746
}
5847

5948
document.addEventListener('DOMContentLoaded', initLanguage);

0 commit comments

Comments
 (0)