diff --git a/src/plugins/rehype-component-gitlab-card.mjs b/src/plugins/rehype-component-gitlab-card.mjs index 89f2906..a0b08b5 100644 --- a/src/plugins/rehype-component-gitlab-card.mjs +++ b/src/plugins/rehype-component-gitlab-card.mjs @@ -35,7 +35,7 @@ export function GitlabCardComponent(properties, children) { h("div", { class: "gc-user" }, repo.split("/")[0]), ]), h("div", { class: "gc-divider" }, "/"), - h("div", { class: `gc-repo ${cardUuid}-repo` }, repo.split("/")[1]), + h(`div#${cardUuid}-repo`, { class: "gc-repo" }, repo.split("/")[1]), ]), h("div", { class: "github-logo" }), ]); @@ -55,7 +55,7 @@ export function GitlabCardComponent(properties, children) { ` fetch('https://gitlab.com/api/v4/projects/${repoE}').then(response => response.json()).then(data => { console.log(data); - document.getElementsByClassName('${cardUuid}-repo')[0].innerText = data.name; + document.getElementById('${cardUuid}-repo').innerText = data.name; document.getElementById('${cardUuid}-description').innerText = data.description?.replace(/:[a-zA-Z0-9_]+:/g, '') || "Description not set"; document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks_count).replaceAll("\u202f", ''); document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.star_count).replaceAll("\u202f", '');