13 lines
641 B
JavaScript
13 lines
641 B
JavaScript
const data_get = document.getElementById("data_get");
|
|
fetch_ask("https://blog.abtmtr.link/api/collections/mtr/posts/quick-q-and-a")
|
|
.then((x) => x.json())
|
|
.then((data) => {
|
|
data_get.innerHTML = data.data.body
|
|
.replace(/^### (.*?$)/gim, '<h3>$1</h3>') // h3 tag
|
|
.replace(/^## (.*?$)/gim, '<h2>$1</h2>') // h2 tag
|
|
.replace(/^# (.*?$)/gim, '<h1>$1</h1>') // h1 tag
|
|
.replace(/\[(.*?)\]\((.*?)\)/gim, '<a href="$2" target="_blank">$1</a>') // link text
|
|
.replace(/\*\*(.*?)\*\*/gim, '<b>$1</b>') // bold text
|
|
.replace(/\*(.*?)\*/gim, '<i>$1</i>') // italic text
|
|
.replace(/\`(.*?)\`/gim, '<code>$1</code>') // code text
|
|
});
|