Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:memo: Describe the current behavior in comments

Jeffrey Chenc1bff9052643
diff --git a/AGENTS.md b/AGENTS.md
index 69856c2334..c9545ac5dd 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -165,7 +165,9 @@ Unambiguous mechanical edits with no behavioral or compatibility impact need no
## 3. Coding conventions
-1. **Comments:** Write in Chinese, wrap at 120 characters, and describe what the code does without referencing the old implementation
+1. **Comments:** Write in Chinese, wrap at 120 characters, and state the behavior in effect now; do not narrate how the code got there or describe it relative to a previous implementation (`不再创建`、`保留旧行为`), and drop any comment that only restates the next line
+ - Keep an issue link only when it explains why the current rule exists
+ - Legacy **data** is the exception: deprecated fields and format migrations must still say which older shape they read
2. **Punctuation:** Use language-appropriate punctuation in UI text, comments, user guides, and documentation (e.g. Chinese punctuation ,。:;!?「」 for Chinese). Keep UI text and its punctuation in i18n language files rather than hard-coding them in code
3. **UI paths:** In all contexts, including code comments, UI text, i18n, user guides, documentation, issue/PR content, and responses, separate navigation levels with a hyphen surrounded by spaces (for example, `设置 - 快捷键 - 通用`); do not use arrow symbols such as `→`
4. **Markdown:** Do not hand-wrap; keep each line (paragraphs, table rows, list items, etc.) on a single line
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index 2e256f7715..c66939d932 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -866,7 +866,7 @@ export class Gutter {
public isMatchNode(item: Element) {
const itemRect = item.getBoundingClientRect();
- // 原本为4,由于 https://github.com/siyuan-note/siyuan/issues/12166 改为 6
+ // 命中偏移 6px,见 https://github.com/siyuan-note/siyuan/issues/12166
let gutterTop = this.element.getBoundingClientRect().top + 6;
if (itemRect.height < Math.floor(window.siyuan.config.editor.fontSize * 1.625) + 8) {
gutterTop = gutterTop - (itemRect.height - this.element.clientHeight) / 2;
diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts
index 4084b80d5e..a6485092ea 100644
--- a/app/src/protyle/render/av/filter.ts
+++ b/app/src/protyle/render/av/filter.ts
@@ -777,7 +777,7 @@ ${genRelationFilterTriggerContent(avID, selectedBlockIDs, path)}<svg class="av__
};
// readInlineValue 从叶子行内 DOM 读取值,按类型返回 { value, relativeDate, relativeDate2 }。
-// 修正点①:date 用 data-type 精确定位,废弃全局 textElements 索引。
+// date 值按 data-type 定位,不依赖全局 textElements 索引。
const readInlineValue = (rowElement: HTMLElement, valueType: TAVCol, operator: string, filter: IAVFilter, menuElement: HTMLElement): { newValue: IAVCellValue, relativeDate: IAVRelativeDate, relativeDate2: IAVRelativeDate } => {
let newValue: IAVCellValue = filter.value;
let relativeDate: IAVRelativeDate = filter.relativeDate;
@@ -812,7 +812,7 @@ const readInlineValue = (rowElement: HTMLElement, valueType: TAVCol, operator: s
const val = input?.value || "";
newValue = val ? genCellValue(valueType, val) : genEmptyCellValue(valueType);
} else if (isAVDateType(valueType)) {
- // 修正点①:用 data-type 精确定位绝对日期 input
+ // 绝对日期 input 按 data-type 定位
const dateTypeSel = rowElement.querySelector('[data-type="dateType"]') as HTMLSelectElement;
const isRelative = dateTypeSel?.value === "custom";
if (isRelative) {
diff --git a/app/src/protyle/render/mathRender.ts b/app/src/protyle/render/mathRender.ts
index b92ab1f890..25df9fe97c 100644
--- a/app/src/protyle/render/mathRender.ts
+++ b/app/src/protyle/render/mathRender.ts
@@ -102,7 +102,7 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid
mathElement.insertAdjacentText("afterend", "\n");
} else {
// https://ld246.com/article/1651595975481,https://ld246.com/article/1658903123429
- // 随着浏览器的升级,从 beforeend 修改为 afterend
+ // ZWSP 插到 KaTeX 外层之后,不进入公式内部
mathElement.insertAdjacentText("afterend", Constants.ZWSP);
}
} else if (nextSibling && nextSibling.nodeType !== 3 &&
diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.ts
index 210bee3ea1..377a706d0f 100644
--- a/app/src/protyle/undo/index.ts
+++ b/app/src/protyle/undo/index.ts
@@ -90,8 +90,7 @@ export class Undo implements IUndo {
countBlockWord(getBlockSelectionStatusIDs(protyle.wysiwyg.element), protyle, true);
}
- // add 降级为:不压栈(kernel 已在 commit 后 Record),仅置位本地镜像 + 刷新按钮态。
- // 保留签名以兼容 transaction.ts 的调用点。
+ // add 只置位本地镜像并刷新按钮态,栈由 kernel 在 commit 后记录;签名仍被 transaction.ts 调用。
public add(doOperations: IOperation[], undoOperations: IOperation[], protyle: IProtyle) {
const rootID = getUndoRootID(protyle);
this.lastHistoryRootID = rootID;
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index f3376a72d9..4eaa0b3baf 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -2503,7 +2503,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
// 拖到数据库视图:绑定为记录
action = window.siyuan.languages.addToDatabase;
} else if (event.altKey || (event.shiftKey && protyle.lite)) {
- // Alt=引用;lite 模式 Shift 也为引用(原嵌入块改为引用)
+ // Alt=引用;lite 模式 Shift 也为引用
action = window.siyuan.languages.dragTipRef;
} else if (event.shiftKey) {
action = window.siyuan.languages.dragTipEmbed;
diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.ts
index 9a6537033b..bbc22b105b 100644
--- a/app/src/protyle/util/insertHTML.ts
+++ b/app/src/protyle/util/insertHTML.ts
@@ -1317,7 +1317,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
}
let innerHTML = unSpinHTML || // 在 table 中插入需要使用转换好的行内元素 https://github.com/siyuan-note/siyuan/issues/9358
- html; // 空格会被 Spin 不再,需要使用原文
+ html; // 空格会被 Spin 丢失,需要使用原文
// 粘贴纯文本时会进行内部转义,这里需要进行反转义 https://github.com/siyuan-note/siyuan/issues/10620
innerHTML = innerHTML.replace(/;;;lt;;;/g, "&lt;").replace(/;;;gt;;;/g, "&gt;");
tempElement.innerHTML = innerHTML;
diff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.ts
index e83ce46aec..e8904c32eb 100644
--- a/app/src/types/api/index.d.ts
+++ b/app/src/types/api/index.d.ts
@@ -3546,7 +3546,7 @@ export interface APIPOSTRoutes {
/**
* 扫描失败返回标准错误,不将失败表示为成功的空列表。
* keyword 可省略、为 null 或空白;非空时按完整文件名进行不区分大小写的字面量包含匹配。
- * 完整未引用扫描后先筛选再截断,最多返回 512 项;空请求体及旧调用保留原有行为。
+ * 完整未引用扫描后先筛选再截断,最多返回 512 项;空请求体按截断返回。
* all 为 true 时返回完整清单且不发送截断提示,供前端在当前面板内过滤;省略、null 或 false 保留截断行为。
* 可选请求头 X-SiYuan-App-ID 将截断提示限定到对应前端,未提供时保留广播行为。
*/
@@ -3825,7 +3825,7 @@ export interface APIPOSTRoutes {
};
/**
* 按模板创建条目;templateID 为空时创建空白游离条目。openAfterCreate 返回模板的交互偏好:
- * true 表示创建后分屏打开,false 表示不打开,省略时保留旧行为(仅日历自动打开)。API 本身不触发界面操作。
+ * true 表示创建后分屏打开,false 表示不打开,省略时仅日历条目自动打开。API 本身不触发界面操作。
*/
"/api/av/createAttributeViewItem": {
request: CreateAttributeViewItemRequestInput;
@@ -5369,7 +5369,7 @@ export interface APIPOSTRoutes {
authorization?: readonly ["authenticated","admin"];
};
/**
- * 保留既有敏感路径和加密边界检查;整本删除不读取已撤销的寻址模式记录。
+ * 保留既有敏感路径和加密边界检查;整本删除时校验树内全部文档寻址记录。
*/
"/api/file/removeFile": {
request: RemoveFileRequestInput;
@@ -5692,7 +5692,7 @@ export interface APIPOSTRoutes {
* 只读编译有效创建目标,同一次计划使用相同时间,日期可指定为 YYYY-MM-DD。
* contextID 是源笔记本内的文档,child 使用该位置,configured 使用配置目标;title 可显式替换最终标题。
* 调用方提前保存最终 id,返回步骤已分配全部祖先 ID。按顺序向 createDocByParent 提交,不承诺跨文件原子性。
- * reuse 仅用于明确允许复用的业务。existingID 非空时不再创建;普通新建应保持 reuse=false。
+ * reuse 仅用于明确允许复用的业务。existingID 非空时不创建;普通新建应保持 reuse=false。
* 上一步创建父文档后,将其返回的 revision 传为下一步 expectedParentRevision;错误或响应丢失时保留计划核对 ID。
*/
"/api/filetree/planDocCreate": {
@@ -5841,7 +5841,7 @@ export interface APIPOSTRoutes {
authorization?: readonly ["authenticated","admin","writable"];
};
/**
- * 图谱查询需要与配置写入互斥;查询自带的配置由配置段发布负责通知,包装层不再补发。
+ * 图谱查询需要与配置写入互斥;查询自带的配置由配置段发布负责通知。
*/
"/api/graph/getGraph": {
request: GlobalGraphRequestInput;
@@ -8169,7 +8169,7 @@ export interface APIPOSTRoutes {
authorization?: readonly ["authenticated","admin"];
};
/**
- * 保持单个 JSON 文件的设置压缩包,不再附加已撤销的 documentAddressing 下界记录。
+ * 导出单个 JSON 文件的设置压缩包。
*/
"/api/system/exportConf": {
request: EmptyRequestInput;
diff --git a/kernel/api/extension.go b/kernel/api/extension.go
index ab1c529d76..5d098440d9 100644
--- a/kernel/api/extension.go
+++ b/kernel/api/extension.go
@@ -251,7 +251,6 @@ var extensionCopy = contractHandler(apicontract.ExtensionCopy, func(c *gin.Conte
}
if ast.NodeText == n.Type {
- // 剔除行首空白
if ast.NodeParagraph == n.Parent.Type && n.Parent.FirstChild == n {
n.Tokens = bytes.TrimLeft(n.Tokens, " \t\n")
}
diff --git a/kernel/api/icon.go b/kernel/api/icon.go
index 4bb920a48a..6e5b8fe3b4 100644
--- a/kernel/api/icon.go
+++ b/kernel/api/icon.go
@@ -52,7 +52,6 @@ var colorSchemes = map[string]ColorScheme{
}
func getColorScheme(color string) ColorScheme {
- // 去除可能的空格
color = strings.TrimSpace(color)
// 检查是否是预定义的颜色
@@ -379,7 +378,6 @@ func daysBetween(date1, date2 time.Time) int {
return days
}
-// 判断是否为闰年
func isLeapYear(year int) bool {
return year%4 == 0 && (year%100 != 0 || year%400 == 0)
}
diff --git a/kernel/apicontract/av_decode.go b/kernel/apicontract/av_decode.go
index 0f45119d7a..17d39145fd 100644
--- a/kernel/apicontract/av_decode.go
+++ b/kernel/apicontract/av_decode.go
@@ -9,7 +9,7 @@ import (
"strings"
)
-// avDecodeBoundFields 仅对原本经过 JSON 结构体绑定的字段保留大小写匹配和数字归一化。
+// avDecodeBoundFields 仅对经过 JSON 结构体绑定的字段保留大小写匹配和数字归一化。
func avDecodeBoundFields[Request any](reader io.Reader, path string, boundFields map[string]string, ignoredBools []string) (request Request, err error) {
fields, err := blockRequestFields(reader, path)
if err != nil {
diff --git a/kernel/apicontract/av_types.go b/kernel/apicontract/av_types.go
index 7f7c8ded3c..cb23b5aee7 100644
--- a/kernel/apicontract/av_types.go
+++ b/kernel/apicontract/av_types.go
@@ -449,7 +449,7 @@ type AVNewItemTemplate struct {
SaveLocation *AVNewItemSaveLocation `json:"saveLocation,omitempty" api:"optional,nullable"`
ContentTemplatePath string `json:"contentTemplatePath,omitempty" api:"optional,nullable"`
HideInFileTree bool `json:"hideInFileTree,omitempty" api:"optional,nullable"`
- // 创建后是否由交互客户端分屏打开绑定或游离条目。省略或 null 保留旧行为(仅日历自动打开);false 禁止自动打开。
+ // 创建后是否由交互客户端分屏打开绑定或游离条目。省略或 null 时仅日历条目自动打开;false 禁止自动打开。
// 该配置随模板保存,API 调用本身不会打开界面;移动端使用已有的页面或弹层。
OpenAfterCreate *bool `json:"openAfterCreate,omitempty" api:"optional,nullable"`
}
@@ -694,7 +694,7 @@ type AVCreateAttributeViewItemResult struct {
Content string `json:"content" api:"optional,nullable"`
IsDetached bool `json:"isDetached" api:"optional,nullable"`
Warnings []string `json:"warnings,omitempty" api:"optional,nullable"`
- // 返回实际使用模板的自动打开偏好,省略时交互客户端保留旧行为;此字段不会触发服务端界面操作。
+ // 返回实际使用模板的自动打开偏好;省略时交互客户端按仅日历条目自动打开处理。此字段不会触发服务端界面操作。
OpenAfterCreate *bool `json:"openAfterCreate,omitempty" api:"optional,nullable"`
}
diff --git a/kernel/apicontract/contracts.go b/kernel/apicontract/contracts.go
index 4a9b379a26..1148da53be 100644
--- a/kernel/apicontract/contracts.go
+++ b/kernel/apicontract/contracts.go
@@ -645,7 +645,7 @@ var ReadDirectory = define[ReadDirectoryRequest, []DirectoryEntry]("readDir", "/
// 新移入的标题含 ASCII / 时必须声明 Spec >= 6,否则返回 -1 和 document title requires spec 6;不自动改写原始内容。
var RenameFile = define[RenameFileRequest, Null]("renameFile", "/api/file/renameFile", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{AdditionalCodes: []int{-3, 403, 404, 409, 500}}, "POST")
-// RemoveFile 保留既有敏感路径和加密边界检查;整本删除不读取已撤销的寻址模式记录。
+// RemoveFile 保留既有敏感路径和加密边界检查;整本删除时校验树内全部文档寻址记录。
var RemoveFile = define[RemoveFileRequest, Null]("removeFile", "/api/file/removeFile", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{AdditionalCodes: []int{-3, 403, 404, 500}}, "POST")
// GlobalCopyFiles 在创建目标目录及复制前预检整批规范路径和文档源;预检不兼容时返回 -1,不写入目标。
@@ -701,7 +701,7 @@ var ResetLocalGraph = define[EmptyRequest, ResetLocalGraphData]("resetLocalGraph
var SetGraphConf = define[SetGraphConfRequest, GraphConfigurationData]("setGraphConf", "/api/graph/setGraphConf", AuthenticatedAccess, JSONBody, ResponseOptions{Setting: SettingWrite{Namespace: "graph"}}, "POST")
-// 图谱查询需要与配置写入互斥;查询自带的配置由配置段发布负责通知,包装层不再补发。
+// 图谱查询需要与配置写入互斥;查询自带的配置由配置段发布负责通知。
var GetGraph = define[GlobalGraphRequest, GlobalGraphData]("getGraph", "/api/graph/getGraph", AuthenticatedAccess, JSONBody, ResponseOptions{DataOnError: true, Setting: SettingWrite{Namespace: "graph", Mode: SettingSilent}}, "POST")
var GetLocalGraph = define[LocalGraphRequest, LocalGraphData]("getLocalGraph", "/api/graph/getLocalGraph", AuthenticatedAccess, JSONBody, ResponseOptions{DataOnError: true, Setting: SettingWrite{Namespace: "graph", Mode: SettingSilent}}, "POST")
@@ -1133,7 +1133,7 @@ var GetDocCreateTarget = define[GetDocCreateTargetRequest, DocumentCreateTargetD
// PlanDocCreate 只读编译有效创建目标,同一次计划使用相同时间,日期可指定为 YYYY-MM-DD。
// contextID 是源笔记本内的文档,child 使用该位置,configured 使用配置目标;title 可显式替换最终标题。
// 调用方提前保存最终 id,返回步骤已分配全部祖先 ID。按顺序向 createDocByParent 提交,不承诺跨文件原子性。
-// reuse 仅用于明确允许复用的业务。existingID 非空时不再创建;普通新建应保持 reuse=false。
+// reuse 仅用于明确允许复用的业务。existingID 非空时不创建;普通新建应保持 reuse=false。
// 上一步创建父文档后,将其返回的 revision 传为下一步 expectedParentRevision;错误或响应丢失时保留计划核对 ID。
var PlanDocCreate = define[PlanDocCreateRequest, DocumentCreatePlan]("planDocCreate", "/api/filetree/planDocCreate", AuthenticatedAccess|AdminAccess, JSONBody, ResponseOptions{}, "POST")
var GetPathByID = define[FileTreeTrimIDRequest, FileTreeDocPathData]("getPathByID", "/api/filetree/getPathByID", AuthenticatedAccess, JSONBody, ResponseOptions{}, "POST")
@@ -1345,7 +1345,7 @@ var RemoveUnusedAssets = define[EmptyRequest, AssetPathsData]("removeUnusedAsset
// 扫描失败返回标准错误,不将失败表示为成功的空列表。
// keyword 可省略、为 null 或空白;非空时按完整文件名进行不区分大小写的字面量包含匹配。
-// 完整未引用扫描后先筛选再截断,最多返回 512 项;空请求体及旧调用保留原有行为。
+// 完整未引用扫描后先筛选再截断,最多返回 512 项;空请求体按截断返回。
// all 为 true 时返回完整清单且不发送截断提示,供前端在当前面板内过滤;省略、null 或 false 保留截断行为。
// 可选请求头 X-SiYuan-App-ID 将截断提示限定到对应前端,未提供时保留广播行为。
var GetUnusedAssets = define[UnusedAssetsRequest, []*AssetUnusedItem]("getUnusedAssets", "/api/asset/getUnusedAssets", AuthenticatedAccess|AdminAccess, LegacyOptionalBody, ResponseOptions{}, "POST")
@@ -1543,7 +1543,7 @@ var GetAttributeViewPasteRows = define[GetAttributeViewPasteRowsRequest, AVPaste
var GetAttributeViewFieldViews = define[GetAttributeViewFieldViewsRequest, AVFieldViewsData]("getAttributeViewFieldViews", "/api/av/getAttributeViewFieldViews", AuthenticatedAccess|WritableAccess, JSONBody, ResponseOptions{}, "POST")
// 按模板创建条目;templateID 为空时创建空白游离条目。openAfterCreate 返回模板的交互偏好:
-// true 表示创建后分屏打开,false 表示不打开,省略时保留旧行为(仅日历自动打开)。API 本身不触发界面操作。
+// true 表示创建后分屏打开,false 表示不打开,省略时仅日历条目自动打开。API 本身不触发界面操作。
var CreateAttributeViewItem = define[CreateAttributeViewItemRequest, AVCreateItemResult]("createAttributeViewItem", "/api/av/createAttributeViewItem", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{DataOnError: true, AdditionalCodes: []int{1}}, "POST")
var CreateAttributeViewRelationItem = define[CreateAttributeViewRelationItemRequest, AVCreateItemResult]("createAttributeViewRelationItem", "/api/av/createAttributeViewRelationItem", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{DataOnError: true, AdditionalCodes: []int{1}}, "POST")
var CreateAttributeViewItemWithMarkdown = define[CreateAttributeViewItemWithMarkdownRequest, AVCreateItemResult]("createAttributeViewItemWithMarkdown", "/api/av/createAttributeViewItemWithMarkdown", AuthenticatedAccess|AdminAccess|WritableAccess, JSONBody, ResponseOptions{DataOnError: true, AdditionalCodes: []int{1}}, "POST")
@@ -1716,7 +1716,7 @@ var SystemEnsureOnboarding = define[EmptyRequest, *SystemOnboarding]("ensureOnbo
// 省略或传入 null 时保持原行为及数字截断规则,认证、管理员权限及加密笔记本关闭流程不变。
var SystemExit = define[SystemExitRequest, SystemExitData]("exit", "/api/system/exit", AuthenticatedAccess|AdminAccess, JSONBody, ResponseOptions{AdditionalCodes: []int{1, 2, 3}, DataOnError: true}, "POST")
-// SystemExportConf 保持单个 JSON 文件的设置压缩包,不再附加已撤销的 documentAddressing 下界记录。
+// SystemExportConf 导出单个 JSON 文件的设置压缩包。
var SystemExportConf = define[EmptyRequest, SystemExportConfData]("exportConf", "/api/system/exportConf", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
var SystemExportLog = define[EmptyRequest, SystemZipData]("exportLog", "/api/system/exportLog", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
var SystemExportTLSCABundle = define[EmptyRequest, SystemPathData]("exportTLSCABundle", "/api/system/exportTLSCABundle", AuthenticatedAccess|AdminAccess, NoBody, ResponseOptions{}, "POST")
diff --git a/kernel/cache/asset.go b/kernel/cache/asset.go
index e86210e351..8a53a16e5a 100644
--- a/kernel/cache/asset.go
+++ b/kernel/cache/asset.go
@@ -110,7 +110,6 @@ func GetAssetHash(hash string) *AssetHash {
return nil
}
- // 验证文件是否存在
if !filelock.IsExist(filepath.Join(util.DataDir, asset.Path)) {
// 文件不存在,清理缓存
delete(assetHashCache, hash)
diff --git a/kernel/conf/export.go b/kernel/conf/export.go
index 2b99e30d71..7807c22b97 100644
--- a/kernel/conf/export.go
+++ b/kernel/conf/export.go
@@ -26,7 +26,7 @@ type Export struct {
// (5:锚点哈希 https://github.com/siyuan-note/siyuan/issues/10265 已经废弃 https://github.com/siyuan-note/siyuan/issues/13331)
// (0:使用原始文本,1:使用 Blockquote,都已经废弃 https://github.com/siyuan-note/siyuan/issues/3155)
BlockRefMode int `json:"blockRefMode"`
- BlockEmbedMode int `json:"blockEmbedMode"` // 内容块引用导出模式,0:使用原始文本,1:使用 Blockquote
+ BlockEmbedMode int `json:"blockEmbedMode"` // 内容块嵌入导出模式,0:使用原始文本,1:使用引述块
BlockRefTextLeft string `json:"blockRefTextLeft"` // 内容块引用导出锚文本左侧符号,默认留空
BlockRefTextRight string `json:"blockRefTextRight"` // 内容块引用导出锚文本右侧符号,默认留空
TagOpenMarker string `json:"tagOpenMarker"` // 标签开始标记符,默认是 #
diff --git a/kernel/filesys/tree.go b/kernel/filesys/tree.go
index 6a498f3e71..7e4cb6d751 100644
--- a/kernel/filesys/tree.go
+++ b/kernel/filesys/tree.go
@@ -154,7 +154,6 @@ func ValidateBoxRelativePath(boxID, p string) (string, error) {
p = filepath.ToSlash(p)
// 记录原始路径用于 IsSubPath 校验
origP := p
- // 标准化:去掉前导 /
p = strings.TrimPrefix(p, "/")
// 根路径直接放行(box 根目录本身是合法路径)
if p == "" {
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 78021ea941..20977c410f 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -663,7 +663,7 @@ func firstAttributeViewFilterContext(contexts []*av.FilterContext) *av.FilterCon
// applyFilterDefaultValues 递归遍历过滤节点树,对叶子节点计算新增行的默认值。
// AND 分组合并后验证所有子节点,OR 分组采用首个可满足的分支;无法满足时不生成默认值。
-// 返回 true 表示遇到 mAsset 过滤,调用方应立即结束全部默认值计算(保留原外层 return 语义)。
+// 返回 true 表示遇到 mAsset 过滤,调用方应立即终止全部默认值计算并丢弃已累积结果。
func applyFilterDefaultValues(filters []*av.ViewFilter, attrView *av.AttributeView, addingItemID string, nearItem av.Item,
templateRelevantKeys map[string][]*av.Key, rollupRelevantKeys map[string]*av.Key,
ret map[string]*av.Value, filterKeyIDs map[string]bool) (stop bool) {
diff --git a/kernel/model/blockial.go b/kernel/model/blockial.go
index b878b80e91..27dc4e0165 100644
--- a/kernel/model/blockial.go
+++ b/kernel/model/blockial.go
@@ -225,7 +225,7 @@ func batchSetBlockAttrs(blockAttrs []map[string]any, writeTree func(*parse.Tree)
}
}
}
- // 不做锚文本刷新
+ // 批量属性写入路径不刷新动态锚文本;需要刷新的调用方按 attrsAffectRefText 白名单自行触发。
return
}
@@ -337,8 +337,8 @@ func attrsAffectRefText(nameValues map[string]string) bool {
// custom-sy-av-s-text-<avID> 属性派生,这些属性变更时需调用 updateAttributeViewBlockText
// 同步到 AV JSON,否则数据库视图中显示的图标/内容不会更新。
//
-// 该同步原本由 refreshDynamicRefText 顺带完成,但 #18058 的锚文本刷新优化用 attrsAffectRefText
-// 门槛拦截了非 name/title 属性的刷新,导致 icon 变更不再触发同步,故此处独立解耦触发
+// icon、name 与 custom-sy-av-s-text-<avID> 的变更必须由 attrsAffectAvBlock 独立触发;
+// 不要依赖 refreshDynamicRefText,它的 attrsAffectRefText 白名单只放行 name/title
// (详见 https://github.com/siyuan-note/siyuan/issues/18204)。
func attrsAffectAvBlock(nameValues map[string]string) bool {
for name := range nameValues {
diff --git a/kernel/model/conf.go b/kernel/model/conf.go
index 33a2c350b4..9bd2b36090 100644
--- a/kernel/model/conf.go
+++ b/kernel/model/conf.go
@@ -587,7 +587,7 @@ func InitConf() {
}
// CLI 子命令通过 --log-level 显式指定日志级别时(util.CLILogLevel 非空),优先使用命令行级别,
- // 不再用 conf.json 的 system.logLevel 覆盖,使命令行参数在初始化早期即生效。
+ // 使命令行参数在初始化早期即生效。
if "" == util.CLILogLevel {
logging.SetLogLevel(Conf.LogLevel)
}
diff --git a/kernel/model/document_addressing_file.go b/kernel/model/document_addressing_file.go
index 8a631db861..832e03f08a 100644
--- a/kernel/model/document_addressing_file.go
+++ b/kernel/model/document_addressing_file.go
@@ -176,7 +176,7 @@ func CheckDocumentAddressingFileCopies(sources, destinations []string) error {
return nil
}
-// CheckDocumentAddressingFileRemoval 保留整本删除语义及规范路径校验。
+// CheckDocumentAddressingFileRemoval 校验整本删除:逐条检查树内文档寻址记录,无记录时校验该路径本身。
func CheckDocumentAddressingFileRemoval(absPath string) error {
var removes []string
err := filepath.WalkDir(absPath, func(name string, entry os.DirEntry, err error) error {
diff --git a/kernel/model/theme.go b/kernel/model/theme.go
index c4273ad435..bab0c198ae 100644
--- a/kernel/model/theme.go
+++ b/kernel/model/theme.go
@@ -360,7 +360,7 @@ func isCSSIdentifierByte(value byte) bool {
'a' <= value && value <= 'z' || 'A' <= value && value <= 'Z'
}
-// 获取主题的样式变量映射表
+// getThemeStyleVar 读取主题 CSS 变量;第三方主题缺基础变量时以 daylight/midnight 兜底。
func getThemeStyleVar(theme string, isDarkMode bool) (ret map[string]string) {
ret = map[string]string{}
diff --git a/kernel/sql/av.go b/kernel/sql/av.go
index 0d1db8a44c..8c33980ea7 100644
--- a/kernel/sql/av.go
+++ b/kernel/sql/av.go
@@ -1066,7 +1066,7 @@ func fillAttributeViewTemplateValuesForKeys(attrView *av.AttributeView, view *av
}
templateKeys, _ := GetTemplateKeysByResolutionOrder(attrView)
- // 按模板内容缓存已编译模板,避免逐行重复 Parse。坏内容缓存为 nil,保留原先「逐行设置 err 并继续」的语义。
+ // 按模板内容缓存已编译模板,避免逐行重复 Parse。坏内容缓存为 nil,逐行设置 err 并继续渲染其余行。
tplCache := map[string]*template.Template{}
compileErrCache := map[string]error{}
storedValueCache := map[*av.Value]*av.Value{}