🐛 fix rendering of markdown for dynamic nav
This commit is contained in:
@@ -79,11 +79,28 @@
|
|||||||
const container = document.querySelector('.comic-container');
|
const container = document.querySelector('.comic-container');
|
||||||
const newDiv = document.createElement('div');
|
const newDiv = document.createElement('div');
|
||||||
newDiv.className = 'comic-transcript';
|
newDiv.className = 'comic-transcript';
|
||||||
newDiv.innerHTML = '<h3>Author Note</h3><p></p>';
|
newDiv.innerHTML = '<h3>Author Note</h3>';
|
||||||
container.appendChild(newDiv);
|
container.appendChild(newDiv);
|
||||||
}
|
}
|
||||||
document.querySelector('.comic-transcript p').textContent = comic.author_note;
|
|
||||||
document.querySelector('.comic-transcript').style.display = 'block';
|
// Clear existing content after the h3
|
||||||
|
const h3 = transcriptDiv.querySelector('h3');
|
||||||
|
while (h3.nextSibling) {
|
||||||
|
h3.nextSibling.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add content based on whether it's HTML or plain text
|
||||||
|
if (comic.author_note_is_html) {
|
||||||
|
const contentDiv = document.createElement('div');
|
||||||
|
contentDiv.innerHTML = comic.author_note;
|
||||||
|
transcriptDiv.appendChild(contentDiv);
|
||||||
|
} else {
|
||||||
|
const contentP = document.createElement('p');
|
||||||
|
contentP.textContent = comic.author_note;
|
||||||
|
transcriptDiv.appendChild(contentP);
|
||||||
|
}
|
||||||
|
|
||||||
|
transcriptDiv.style.display = 'block';
|
||||||
} else if (transcriptDiv) {
|
} else if (transcriptDiv) {
|
||||||
transcriptDiv.style.display = 'none';
|
transcriptDiv.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user