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: 引用提示中属性、内容转义
Vanessaa045989c15b3
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.tsindex 8dca51229a..1d2fe0c5d2 100644--- a/app/src/protyle/hint/extend.ts+++ b/app/src/protyle/hint/extend.ts@@ -307,13 +307,13 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintDconst iconName = getIconByType(item.type);let attrHTML = "";if (item.name) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${item.name}</span><span class="fn__space"></span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${escapeHtml(item.name)}</span><span class="fn__space"></span>`;}if (item.alias) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${item.alias}</span><span class="fn__space"></span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${escapeHtml(item.alias)}</span><span class="fn__space"></span>`;}if (item.memo) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${item.memo}</span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${escapeHtml(item.memo)}</span>`;}if (attrHTML) {attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;@@ -326,9 +326,9 @@ export const hintRef = (key: string, protyle: IProtyle, isQuick = false): IHintDvalue,html: `${attrHTML}<div class="b3-list-item__first"><svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>- <span class="b3-list-item__text">${item.content}</span>+ <span class="b3-list-item__text">${escapeHtml(item.content)}</span></div>-<div class="b3-list-item__meta">${escapeHtml(item.hPath)}</div>`,+<div class="b3-list-item__meta">${item.hPath}</div>`,});});if (isQuick) {@@ -363,13 +363,13 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {const iconName = getIconByType(item.type);let attrHTML = "";if (item.name) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${item.name}</span><span class="fn__space"></span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${escapeHtml(item.name)}</span><span class="fn__space"></span>`;}if (item.alias) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${item.alias}</span><span class="fn__space"></span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${escapeHtml(item.alias)}</span><span class="fn__space"></span>`;}if (item.memo) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${item.memo}</span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${escapeHtml(item.memo)}</span>`;}if (attrHTML) {attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;@@ -378,7 +378,7 @@ export const hintEmbed = (key: string, protyle: IProtyle): IHintData[] => {value: `{{select * from blocks where id='${item.id}'}}`,html: `${attrHTML}<div class="b3-list-item__first"><svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>- <span class="b3-list-item__text">${item.content}</span>+ <span class="b3-list-item__text">${escapeHtml(item.content)}</span></div><div class="b3-list-item__meta">${item.hPath}</div>`,});diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex 1fed739bfe..11ea7f02d4 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -297,13 +297,13 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;const iconName = getIconByType(item.type);let attrHTML = "";if (item.name) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${item.name}</span><span class="fn__space"></span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconN"></use></svg> ${escapeHtml(item.name)}</span><span class="fn__space"></span>`;}if (item.alias) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${item.alias}</span><span class="fn__space"></span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconA"></use></svg> ${escapeHtml(item.alias)}</span><span class="fn__space"></span>`;}if (item.memo) {- attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${item.memo}</span>`;+ attrHTML += `<span class="fn__flex"><svg class="fn__flex-center svg--small svg ft__on-background"><use xlink:href="#iconM"></use></svg> ${escapeHtml(item.memo)}</span>`;}if (attrHTML) {attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;@@ -311,9 +311,9 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;const blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${index === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefHTML)}">${attrHTML}<div class="b3-list-item__first"><svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>- <span class="b3-list-item__text">${item.content}</span>+ <span class="b3-list-item__text">${escapeHtml(item.content)}</span></div>-<div class="b3-list-item__meta">${escapeHtml(item.hPath)}</div></button>`;+<div class="b3-list-item__meta">${item.hPath}</div></button>`;});if (searchHTML === "") {searchHTML = `<button class="b3-list-item b3-list-item--two fn__block" data-value="">${window.siyuan.languages.emptyContent}</button>`;