-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (22 loc) · 874 Bytes
/
script.js
File metadata and controls
25 lines (22 loc) · 874 Bytes
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
const load = () => {
fetch('/updates/articleList.json')
.then(res => res.json())
.then(articles => {
articles = articles.articles;
document.getElementById('articleNumber').innerText = articles.length.toString();
articles.forEach(article => {
const converter = new showdown.Converter();
const markdown = article.content;
const newHTML = converter.makeHtml(markdown);
console.log(article);
document.getElementById('articles').insertAdjacentHTML('beforeend', `
<article>
<h3>
<timestamp>${article.date}</timestamp>
</h3>
<p>${newHTML}</p>
</article>
`);
})
})
};