ElyMark: task boxes are drawn at text size on the first line (R2.14)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-09 03:57:56 -04:00
1 parent f28768634f
commit c77bd2a281
3 files changed
+27 -2

No files matched your search

+11
View File
@@ -56,6 +56,17 @@ const CHECK: &str = r#"
inline: seen(view.querySelector('.milkdown p .katex')),
display: seen(view.querySelector('.milkdown p .katex-display')),
tasks: view.querySelectorAll('li[data-item-type="task"]').length,
box: (() => {
const item = view.querySelector('li[data-item-type="task"]');
if (!item) return null;
const mark = getComputedStyle(item, '::before');
const range = document.createRange();
range.selectNodeContents(item.querySelector('p'));
const line = range.getClientRects()[0];
const top = item.getBoundingClientRect().top + parseFloat(mark.marginTop);
const size = parseFloat(getComputedStyle(item).fontSize);
return [parseFloat(mark.width) / size, parseFloat(mark.height) / size, top + parseFloat(mark.height) / 2 - (line.top + line.height / 2)];
})(),
cells: view.querySelectorAll('.milkdown td').length,
notes: view.querySelectorAll('[data-type="footnote_definition"]').length,
blocks,