todo fixes
This commit is contained in:
1 parent
fe93a0f80e
commit
940d9bbde4
8 files changed
+135
-47
No files matched your search
@@ -98,6 +98,22 @@ export function addCodeCopyButtons(container) {
|
||||
});
|
||||
}
|
||||
|
||||
export function formatTodoItems(container) {
|
||||
if (!container) return;
|
||||
container.querySelectorAll('li').forEach(li => {
|
||||
const cb = li.querySelector('input[type="checkbox"]');
|
||||
if (!cb) return;
|
||||
if (li.classList.contains('todo-item')) return;
|
||||
li.classList.add('todo-item');
|
||||
if (cb.checked) li.classList.add('todo-done');
|
||||
// Wrap remaining text nodes in a span
|
||||
const span = document.createElement('span');
|
||||
span.className = 'todo-text';
|
||||
while (cb.nextSibling) span.appendChild(cb.nextSibling);
|
||||
li.appendChild(span);
|
||||
});
|
||||
}
|
||||
|
||||
export function stripMd(src) {
|
||||
return (src || '')
|
||||
.replace(/<img[^>]*>/gi, '')
|
||||
|
||||
Reference in new issue
Block a user