-
剪藏能否实现这个网页中的公式显示?
2024-05-26 23:34@88250 为什么有的公式可以在公式块里正常显示,而行级公式就不行呢?
知乎里的行级公式是能显示的
\begin{align} F(t)=&m(t)+v(t)\\ =&m(t)+\displaystyle \color{brown}{\mathop{v_e(t)}^{振幅}}\cos\left(2\pi \color{blue}{\mathop{v_r(t)}^{速率}}\right.\cdot\mathop{\left.\frac{t}{\color{purple}{f_s}}\right)}_{\color{purple}{基频采样频率}} \end{align}
-
剪藏能否实现自动将 LaTeX 格式的数学表达式转换为 Markdown 格式?
2024-05-26 23:11啥意思?我想明白了,你说的应该是用
$$
包裹的公式块才能正常显示某些公式。p.s.
$
和$$
都是 Markdown 语法,在思源里前者是行级公式,后者是公式块p.s.s. 这个显示效果不同的问题我去你的另一个帖子问一下
-
剪藏能否实现自动将 LaTeX 格式的数学表达式转换为 Markdown 格式?
2024-05-26 20:45按理说在思源里剪藏 LaTeX 只是不能自动转 KaTeX ,转 Markdown (即首尾添加 $ )应该是正常的
-
JS 片段分享:限制数据库换行文本最大行数
2024-05-26 18:18我自己用的版本:
// 限制数据库换行文本最大行数 JS片段 - author: JeffreyChen var animationFrameRequestId = null; // 用于存储 requestAnimationFrame 的 ID function updateAriaLabels() { // 数据库渲染后所有 aria-label 属性都会丢失,所以直接全部添加即可 // 如果已经有一个动画帧请求在等待,取消它 if (animationFrameRequestId !== null) { cancelAnimationFrame(animationFrameRequestId); } animationFrameRequestId = requestAnimationFrame(function() { document.querySelectorAll('.av__row:not(.av__row--header) .av__cell[data-wrap="true"]').forEach(cell => { const textElement = cell.querySelector('.av__celltext'); // 查找包含文本的子元素 // 检查父元素是否已有 aria-label 属性、是否是有效的 DOM 元素、文本是否被截断 if (!cell.getAttribute('aria-label') && textElement && textElement.scrollHeight > textElement.clientHeight) { const text = textElement.textContent.trim(); // 提取文本 cell.setAttribute('aria-label', text); // 为单元格添加 aria-label 属性 } }); // 重置 animationFrameRequestId,以便下次调用 updateAriaLabels 时可以检查 animationFrameRequestId = null; }); } function updateAriaLabels2() { // 调整列(宽)后 aria-label 仍然保留,需要逐个判断移除或者添加;调整列(宽)后切换到镜像数据库时也需要逐个判断移除或者添加 // 如果已经有一个动画帧请求在等待,取消它 if (animationFrameRequestId !== null) { cancelAnimationFrame(animationFrameRequestId); } animationFrameRequestId = requestAnimationFrame(function() { document.querySelectorAll('.av__row:not(.av__row--header) .av__cell[data-wrap="true"]').forEach(cell => { const textElement = cell.querySelector('.av__celltext'); // 查找包含文本的子元素 // 检查父元素是否已有 aria-label 属性、是否是有效的 DOM 元素、文本是否被截断 if (cell.getAttribute('aria-label') && textElement && !(textElement.scrollHeight > textElement.clientHeight)) { cell.removeAttribute('aria-label'); // 为无截断文本的单元格移除 aria-label 属性 } else if (!cell.getAttribute('aria-label') && textElement && textElement.scrollHeight > textElement.clientHeight) { const text = textElement.textContent.trim(); // 提取文本 cell.setAttribute('aria-label', text); // 为有截断文本单元格添加 aria-label 属性 } }); // 重置 animationFrameRequestId,以便下次调用 updateAriaLabels 时可以检查 animationFrameRequestId = null; }); } var timeoutId = null; // 创建一个新的 MutationObserver 实例,并提供一个回调函数 const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.type === 'attributes') { // 数据库渲染:检查被修改的节点是否是数据库 av 类型并且已经渲染完成 if (mutation.target.classList.contains('av') && mutation.target.getAttribute('data-render') === 'true') { clearTimeout(timeoutId); timeoutId = setTimeout(function() { updateAriaLabels() }, 500); // 500 毫秒延时。用以避免短时间内重复执行 // 调整列(宽):检查被修改的节点是否是数据库列头并且开启了换行;或者是否是切换页签 } else if (mutation.target.classList.contains('av__cell--header') && mutation.target.getAttribute('data-wrap') === 'true' || mutation.target.classList.contains('item--focus')) { clearTimeout(timeoutId); timeoutId = setTimeout(function() { updateAriaLabels2() }, 500); // 500 毫秒延时。拖拽的过程中属性会高频变化,此时不继续运行 } } }); }); // 配置MutationObserver以观察DOM树的变化 const config = { attributes: true, childList: false, subtree: true }; // 开始观察 observer.observe(document.body, config); // 创建一个新的style元素 var style = document.createElement('style'); // 添加CSS代码 style.textContent = ` /* 限制数据库换行文本最大行数 CSS片段 */ .av__row:not(.av__row--header) .av__cell[data-wrap="true"] .av__celltext { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; /* 最多3行 */ overflow: hidden; } .av__celltext--ref { border-bottom: 0px; text-decoration: underline; /* 下划线 */ text-decoration-color: rgb(0 202 255 / 85%); /* 浅蓝色 */ text-decoration-thickness: 2px; } `; // 将style元素添加到文档的head中 document.head.appendChild(style);
-
JS 片段分享:限制数据库换行文本最大行数
2024-05-26 18:18纯 CSS:
.av__row:not(.av__row--header) .av__cell[data-wrap="true"]:not([data-block-id]) .av__celltext { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; /* 最多3行 */ overflow: hidden; }
-
【已解决】部分文档数据库属性不显示的问题
2024-05-26 13:35下个版本会修复一个绑定已有块的属性不正确的问题:Issue #11460 · siyuan-note/siyuan
可以等下个版本再试试。
另外这个有问题的数据库和文档希望可以保留一下,如果下个版本还有问题的话可以上传