fix(post): proper headings
This commit is contained in:
parent
736339c924
commit
7a0ffdff52
1 changed files with 7 additions and 2 deletions
|
|
@ -27,6 +27,9 @@ const makeFold = (h, i) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const mdHeading = document.createElement("span");
|
const mdHeading = document.createElement("span");
|
||||||
|
console.log(
|
||||||
|
`header ${h.tagName} getting prefix ${tagToHeader.get(h.tagName)}, ${h.textContent}`,
|
||||||
|
);
|
||||||
const header = tagToHeader.has(h.tagName) ? tagToHeader.get(h.tagName) : "";
|
const header = tagToHeader.has(h.tagName) ? tagToHeader.get(h.tagName) : "";
|
||||||
mdHeading.textContent = `${header} `;
|
mdHeading.textContent = `${header} `;
|
||||||
mdHeading.style.color = getTopicColor(urlToTopic());
|
mdHeading.style.color = getTopicColor(urlToTopic());
|
||||||
|
|
@ -38,12 +41,14 @@ const makeFold = (h, i) => {
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
document.querySelectorAll("article h2").forEach((h2) => {
|
document.querySelectorAll("article h2").forEach((h2) => {
|
||||||
const mdHeading = document.createElement("span");
|
const mdHeading = document.createElement("span");
|
||||||
mdHeading.textContent = "# ";
|
|
||||||
mdHeading.style.fontStyle = "normal";
|
mdHeading.style.fontStyle = "normal";
|
||||||
mdHeading.style.color = getTopicColor(urlToTopic());
|
mdHeading.style.color = getTopicColor(urlToTopic());
|
||||||
h2.prepend(mdHeading);
|
h2.prepend(mdHeading);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll(".fold h2").forEach(makeFold);
|
document.querySelectorAll(".fold h2").forEach((x) => {
|
||||||
|
console.log("making h2 fold");
|
||||||
|
makeFold(x);
|
||||||
|
});
|
||||||
document.querySelectorAll(".fold h3").forEach(makeFold);
|
document.querySelectorAll(".fold h3").forEach(makeFold);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue