Fix image rendering in markdown comments
- markdown.js: add renderMarkdownComments() called on DOMContentLoaded to process [data-markdown] elements that were never being rendered on page load - CSP: allow https: in img-src so external images in markdown aren't blocked Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -436,11 +436,24 @@ function processPlainTextComments() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Render all [data-markdown] comment elements that haven't been rendered yet
|
||||
*/
|
||||
function renderMarkdownComments() {
|
||||
document.querySelectorAll('.comment-text[data-markdown]:not([data-rendered])').forEach(el => {
|
||||
el.innerHTML = parseMarkdown(el.textContent);
|
||||
el.dataset.rendered = '1';
|
||||
});
|
||||
}
|
||||
|
||||
// Run on page load
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
renderMarkdownComments();
|
||||
processPlainTextComments();
|
||||
});
|
||||
|
||||
window.renderMarkdownComments = renderMarkdownComments;
|
||||
|
||||
// Expose for manual use
|
||||
window.autoLinkUrls = autoLinkUrls;
|
||||
window.processPlainTextComments = processPlainTextComments;
|
||||
|
||||
Reference in New Issue
Block a user