An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/14719
Vanessaaa4eb5ba9eea
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.tsindex 241e0746af..f5d0c3d1d2 100644--- a/app/src/protyle/export/index.ts+++ b/app/src/protyle/export/index.ts@@ -323,7 +323,7 @@ const renderPDF = async (id: string) => {item.parentElement.style.width = Math.min(item.parentElement.clientWidth, width) + "px";item.removeAttribute('data-render');})- Protyle.highlightRender(previewElement, "${servePath}/stage/protyle");+ Protyle.highlightRender(previewElement, "${servePath}/stage/protyle", document.querySelector("#scale").value);previewElement.querySelectorAll('[data-type="NodeMathBlock"]').forEach((item) => {// 超级块内不能移除 width https://github.com/siyuan-note/siyuan/issues/14318item.removeAttribute('data-render');diff --git a/app/src/protyle/render/highlightRender.ts b/app/src/protyle/render/highlightRender.tsindex 585d36c900..dfd3ba6752 100644--- a/app/src/protyle/render/highlightRender.ts+++ b/app/src/protyle/render/highlightRender.ts@@ -3,7 +3,7 @@ import {Constants} from "../../constants";import {focusByOffset} from "../util/selection";import {setCodeTheme} from "../../util/assets";-export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) => {+export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN, zoom = 1) => {let codeElements: NodeListOf<Element>;let isPreview = false;if (element.classList.contains("code-block")) {@@ -93,7 +93,7 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =// 需要先添加 class 以防止抖动 https://ld246.com/article/1648116585443block.firstElementChild.className = "protyle-linenumber__rows";block.firstElementChild.setAttribute("contenteditable", "false");- lineNumberRender(block);+ lineNumberRender(block, zoom);block.style.display = "";} else {block.firstElementChild.className = "fn__none";@@ -116,7 +116,7 @@ export const highlightRender = (element: Element, cdn = Constants.PROTYLE_CDN) =});};-export const lineNumberRender = (block: HTMLElement) => {+export const lineNumberRender = (block: HTMLElement, zoom = 1) => {const lineNumber = block.parentElement.getAttribute("lineNumber");if (lineNumber === "false") {return;@@ -140,7 +140,7 @@ export const lineNumberRender = (block: HTMLElement) => {lineNumberTemp.className = "hljs";// 不能使用 codeElement.clientWidth,被忽略小数点导致宽度不一致lineNumberTemp.setAttribute("style", `padding-left:${codeElement.style.paddingLeft};-width: ${codeElement.getBoundingClientRect().width}px;+width: ${codeElement.getBoundingClientRect().width / zoom}px;white-space:${codeElement.style.whiteSpace};word-break:${codeElement.style.wordBreak};font-variant-ligatures:${codeElement.style.fontVariantLigatures};