1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

add comment system to the blogs

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2023-04-18 23:03:05 +05:30
parent 421bb616ec
commit fcf7bc3ed3
4 changed files with 30 additions and 11 deletions
+25
View File
@@ -70,6 +70,30 @@ customElements.define(
}
}
addComments() {
window.remark_config = {
host: "https://remark42.avinal.space",
site_id: "remark",
theme: "dark",
show_rss_subscription: false,
no_footer: true,
};
!(function (e, n) {
for (var o = 0; o < e.length; o++) {
var r = n.createElement("script"),
c = ".js",
d = n.head || n.body;
"noModule" in r
? ((r.type = "module"), (c = ".mjs"))
: (r.async = !0),
(r.defer = !0),
(r.src = remark_config.host + "/web/" + e[o] + c),
d.appendChild(r);
}
})(remark_config.components || ["embed"], document);
}
runMarked() {
const renderer = new marked.Renderer();
const data = this.getAttribute("markdowndata");
@@ -134,6 +158,7 @@ customElements.define(
this.innerHTML = marked.parse(data);
console.log("Markdown rendering complete!");
this.addLineNumber();
this.addComments();
if (fragment) {
console.log(