An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
{
"ID": "20201117101902-2ewjjum",
"Spec": "2",
"Type": "NodeDocument",
"Properties": {
"id": "20201117101902-2ewjjum",
"title": "嵌入内容块",
"type": "doc",
"updated": "20261024163828"
},
"Children": [
{
"ID": "20210111224435-y1fesd1",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20210111224435-y1fesd1",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "概述"
}
]
},
{
"ID": "20201224120447-1ros46z",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-1ros46z",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入内容块根据查询在当前位置展示所需内容块,适合汇总任务、整理主题或集中查看分散的笔记。"
}
]
},
{
"ID": "20261024163828-zud01rx",
"Type": "NodeHeading",
"Properties": {
"id": "20261024163828-zud01rx",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "插入 SQL 嵌入"
}
],
"HeadingLevel": 3
},
{
"ID": "20261024163828-w2n84jl",
"Type": "NodeParagraph",
"Properties": {
"id": "20261024163828-w2n84jl",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeText",
"Data": "将 SQL 查询放在 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{{"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "}}"
},
{
"Type": "NodeText",
"Data": " 之间,并独占一行,例如 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "{{ SELECT * FROM blocks WHERE content LIKE '%关键字%' }}"
},
{
"Type": "NodeText",
"Data": "。可查询的表和字段见 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "block-ref",
"TextMarkBlockRefID": "20201222093044-rx4zjoy",
"TextMarkBlockRefSubtype": "s",
"TextMarkTextContent": "SQL 索引表"
},
{
"Type": "NodeText",
"Data": "。"
}
]
},
{
"ID": "20261024163828-3he7riq",
"Type": "NodeParagraph",
"Properties": {
"id": "20261024163828-3he7riq",
"updated": "20261024163828"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "内容块/嵌入"
}
]
},
{
"ID": "20201224120447-e6zyfti",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20201224120447-e6zyfti",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "示例"
}
]
},
{
"ID": "20201224120447-znjkoy5",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20201224120447-znjkoy5",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20201224120447-n30ybcs",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20201224120447-n30ybcs",
"updated": "20201224120447"
},
"Children": [
{
"ID": "20201224120447-qmgtpok",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-qmgtpok",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeText",
"Data": "查询内容中包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "内容块"
},
{
"Type": "NodeText",
"Data": " 的"
},
{
"Type": "NodeText",
"Data": "列表项"
},
{
"Type": "NodeText",
"Data": ":"
}
]
},
{
"ID": "20201224120447-7zxu4l5",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20201224120447-7zxu4l5",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"Type": "NodeCodeBlockCode",
"Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND type = 'i' }}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20201224120447-s8m8new",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20201224120447-s8m8new",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20201224120447-5c10xrv",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-5c10xrv",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeText",
"Data": "查询内容中同时包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "内容块"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "引用"
},
{
"Type": "NodeText",
"Data": " "
},
{
"Type": "NodeText",
"Data": "段落块"
},
{
"Type": "NodeText",
"Data": ":"
}
]
},
{
"ID": "20201224120447-0y91i5d",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20201224120447-0y91i5d",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"Type": "NodeCodeBlockCode",
"Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND content LIKE '%引用%' AND type = 'p' }}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
},
{
"ID": "20201224120447-7lzhgko",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20201224120447-7lzhgko",
"updated": "20201224120447"
},
"Children": [
{
"ID": "20201224120447-pnqwe31",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-pnqwe31",
"updated": "20210503151034"
},
"Children": [
{
"Type": "NodeText",
"Data": "查询内容中同时包含 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "内容块"
},
{
"Type": "NodeText",
"Data": " 和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "嵌入"
},
{
"Type": "NodeText",
"Data": " 的标题块并按更新时间降序结果取前 "
},
{
"Type": "NodeText",
"Data": "2"
},
{
"Type": "NodeText",
"Data": " 条:"
}
]
},
{
"ID": "20201224120447-zgg5lvx",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20201224120447-zgg5lvx",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "c3Fs"
},
{
"Type": "NodeCodeBlockCode",
"Data": "{{ SELECT * FROM blocks WHERE content LIKE '%内容块%' AND content LIKE '%嵌入%' AND type = 'h' ORDER BY updated DESC LIMIT 2 }}\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
}
]
}
]
},
{
"ID": "20201224120447-fnapz6h",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20201224120447-fnapz6h",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例一"
}
]
},
{
"ID": "20201224120447-acd7hwp",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-acd7hwp",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeText",
"Data": "查询最近更新的 7 个非空段落块:"
}
]
},
{
"ID": "20210111224926-ju1sd4d",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20210111224926-ju1sd4d",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks WHERE type = 'p' AND content != '' ORDER BY updated DESC LIMIT 7"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20201224120447-ickbh88",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20201224120447-ickbh88",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例二"
}
]
},
{
"ID": "20201224120447-53y8c84",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-53y8c84",
"updated": "20240731204712"
},
"Children": [
{
"Type": "NodeText",
"Data": "查询包含标签 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#内容块/嵌入#"
},
{
"Type": "NodeText",
"Data": " 或 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "#内容块/引用#"
},
{
"Type": "NodeText",
"Data": " 的"
},
{
"Type": "NodeText",
"Data": "段落块"
},
{
"Type": "NodeText",
"Data": ":"
}
]
},
{
"ID": "20201224120447-veyqmvr",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20201224120447-veyqmvr",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks WHERE (content LIKE '%#内容块/嵌入#%' OR content LIKE '%#内容块/引用#%') AND hpath NOT LIKE '%嵌入内容块%' AND type = 'p'"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20201224120447-v7yfh5v",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20201224120447-v7yfh5v",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例三"
}
]
},
{
"ID": "20201224120447-s5zmpsa",
"Type": "NodeParagraph",
"Properties": {
"id": "20201224120447-s5zmpsa",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeText",
"Data": "有时候我们可能需要随机漫游显示"
},
{
"Type": "NodeText",
"Data": "内容块"
},
{
"Type": "NodeText",
"Data": ",以方便回顾。"
}
]
},
{
"ID": "20201224120447-kewa9nr",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20201224120447-kewa9nr",
"updated": "20201224120447"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks ORDER BY random() LIMIT 3"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20210630172050-m3pgmkt",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20210630172050-m3pgmkt",
"updated": "20260612202058"
},
"Children": [
{
"Type": "NodeText",
"Data": "案例四"
}
]
},
{
"ID": "20210630172058-rpr2p31",
"Type": "NodeParagraph",
"Properties": {
"id": "20210630172058-rpr2p31",
"updated": "20210630172500"
},
"Children": [
{
"Type": "NodeText",
"Data": "查询未完成的任务"
},
{
"Type": "NodeText",
"Data": "列表项"
},
{
"Type": "NodeText",
"Data": ","
},
{
"Type": "NodeText",
"Data": "这里"
},
{
"Type": "NodeText",
"Data": "需要使用 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "markdown"
},
{
"Type": "NodeText",
"Data": " 字段而不是 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "content"
},
{
"Type": "NodeText",
"Data": " 字段:"
}
]
},
{
"ID": "20210630172118-iu2hsz3",
"Type": "NodeBlockQueryEmbed",
"Properties": {
"id": "20210630172118-iu2hsz3",
"updated": "20211008203521"
},
"Children": [
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeOpenBrace"
},
{
"Type": "NodeBlockQueryEmbedScript",
"Data": "SELECT * FROM blocks WHERE markdown LIKE '%[ ]%' AND subtype = 't' AND type = 'i'"
},
{
"Type": "NodeCloseBrace"
},
{
"Type": "NodeCloseBrace"
}
]
},
{
"ID": "20260612202058-4nvpz56",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20260612202058-4nvpz56",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入块执行 JavaScript"
}
]
},
{
"ID": "20260612202058-q54zwf8",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-q54zwf8",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入块支持通过 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "//!js"
},
{
"Type": "NodeText",
"Data": " 前缀执行 JavaScript 代码,动态决定要嵌入哪些块,适合 SQL 查询无法满足的复杂场景。"
}
]
},
{
"ID": "20260924143000-ohuxobn",
"Type": "NodeParagraph",
"Properties": {
"id": "20260924143000-ohuxobn",
"updated": "20260924143000"
},
"Children": [
{
"Type": "NodeText",
"Data": "导出图片或 PDF 时会渲染 JavaScript 嵌入块,并等待脚本和块查询完成后再导出。安全模式和远程内核环境仍然禁止执行脚本。"
}
]
},
{
"ID": "20260612202058-1tfila8",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202058-1tfila8",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "编辑方式"
}
]
},
{
"ID": "20260612202058-paqopye",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-paqopye",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "在嵌入块编辑框中输入以 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "//!js"
},
{
"Type": "NodeText",
"Data": " 开头的代码即可进入 JS 模式。"
}
]
},
{
"ID": "20260612202058-u31815k",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202058-u31815k",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "可用的上下文变量"
}
]
},
{
"ID": "20260612202058-ef6nmf4",
"Type": "NodeTable",
"TableAligns": [
0,
0,
0
],
"Properties": {
"colgroup": "||",
"id": "20260612202058-ef6nmf4",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeTableHead",
"Data": "thead",
"Children": [
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "参数"
}
]
},
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "类型"
}
]
},
{
"Type": "NodeTableCell",
"Data": "th",
"Children": [
{
"Type": "NodeText",
"Data": "说明"
}
]
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "fetchSyncPost"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "(url, data?, headers?, process?, signal?) => Promise<IWebSocketData>"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "发起异步 POST 请求,使用 await 或 .then() 读取响应;第三个参数是请求头对象,不是回调函数"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "item"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "HTMLElement"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "当前嵌入块 DOM 元素"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "protyle"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "IProtyle"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "当前文档的 Protyle 编辑器实例"
}
]
}
]
},
{
"Type": "NodeTableRow",
"Data": "tr",
"Children": [
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "top"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "number | undefined"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeText",
"Data": "滚动位置(前进/后退定位用)"
}
]
}
]
}
]
},
{
"ID": "20260612202058-8ljs229",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202058-8ljs229",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeText",
"Data": "返回值"
}
]
},
{
"ID": "20260612202058-7u53ctj",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-7u53ctj",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "要自动渲染内容块,请"
},
{
"Type": "NodeTextMark",
"TextMarkType": "strong",
"TextMarkTextContent": "返回一个块 ID 数组"
},
{
"Type": "NodeText",
"Data": "("
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "string[]"
},
{
"Type": "NodeText",
"Data": ",格式为 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "YYYYMMDDHHMMSS-[a-z0-9]{7}"
},
{
"Type": "NodeText",
"Data": "),支持同步和异步:"
}
]
},
{
"ID": "20260612202058-2dobv32",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202058-2dobv32",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\n// 同步返回\nreturn [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"];\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20261024162311-5z8dz71",
"Type": "NodeParagraph",
"Properties": {
"id": "20261024162311-5z8dz71",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeText",
"Data": "也可以返回 Promise。下面是另一种写法,与上面的同步示例分别使用:"
}
]
},
{
"ID": "20261024162311-uhu20nv",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20261024162311-uhu20nv",
"updated": "20261024162311"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\n// 异步返回(Promise 会被自动 await)\nreturn fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待办\" })\n .then(r => r.data.blocks.map(b => b.id));\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202058-81vbloa",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-81vbloa",
"updated": "20261016202635"
},
"Children": [
{
"Type": "NodeText",
"Data": "返回数组中 ID 的顺序即为最终显示顺序。"
}
]
},
{
"ID": "20260612202058-dt9gwb2",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202058-dt9gwb2",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "实用示例"
}
]
},
{
"ID": "20260612202058-8quyqb9",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-8quyqb9",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "嵌入固定的几个块:"
}
]
},
{
"ID": "20260612202058-tv6co88",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202058-tv6co88",
"updated": "20260809232000"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nreturn [\n \"20240601150405-a1b2c3d\",\n \"20240601150405-e4f5g6h\"\n];\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202058-nzro8zw",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-nzro8zw",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "通过全文搜索动态获取:"
}
]
},
{
"ID": "20260612202058-wp4nan2",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202058-wp4nan2",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nconst resp = await fetchSyncPost(\"/api/search/fulltextSearch\", { query: \"待办\" });\nif (resp.code !== 0) {\n throw new Error(resp.msg);\n}\nreturn resp.data.blocks.map(b => b.id);\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202058-2v9xnq8",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-2v9xnq8",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "获取当前文档的直接子块:"
}
]
},
{
"ID": "20260612202058-wvrepjj",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202058-wvrepjj",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nconst docID = protyle.block.rootID;\nconst resp = await fetchSyncPost(\"/api/block/getChildBlocks\", { id: docID });\nif (resp.code !== 0) {\n throw new Error(resp.msg);\n}\nreturn resp.data.map(b => b.id);\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202058-kb0mobj",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-kb0mobj",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "按自定义属性过滤:"
}
]
},
{
"ID": "20260612202058-6kivtwm",
"Type": "NodeCodeBlock",
"IsFencedCodeBlock": true,
"Properties": {
"id": "20260612202058-6kivtwm",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeCodeBlockFenceOpenMarker",
"Data": "```"
},
{
"Type": "NodeCodeBlockFenceInfoMarker",
"CodeBlockInfo": "anM="
},
{
"Type": "NodeCodeBlockCode",
"Data": "//!js\nconst resp = await fetchSyncPost(\"/api/attr/batchGetBlockAttrs\", {\n ids: [\"20240601150405-a1b2c3d\", \"20240601150405-e4f5g6h\"]\n});\nif (resp.code !== 0) {\n throw new Error(resp.msg);\n}\nconst filtered = Object.entries(resp.data)\n .filter(([id, attrs]) => attrs[\"custom-tag\"] === \"重要\")\n .map(([id]) => id);\nreturn filtered;\n"
},
{
"Type": "NodeCodeBlockFenceCloseMarker",
"Data": "```"
}
]
},
{
"ID": "20260612202058-7o8g0fu",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20260612202058-7o8g0fu",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "特性与限制"
}
]
},
{
"ID": "20260612202058-ih0e8zv",
"Type": "NodeList",
"ListData": {
"Typ": 1
},
"Properties": {
"id": "20260612202058-ih0e8zv",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20260612202058-x78zwd5",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "MS4=",
"Num": 1
},
"Properties": {
"id": "20260612202058-x78zwd5",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202058-eixyatk",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-eixyatk",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "不做自动索引"
},
{
"Type": "NodeText",
"Data": ":JS 模式嵌入块需要浏览器运行时环境,后端不会自动索引更新内容,由前端主动渲染"
}
]
}
]
},
{
"ID": "20260612202058-zjwzokw",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "Mi4=",
"Num": 2
},
"Properties": {
"id": "20260612202058-zjwzokw",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202058-57rsop5",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-57rsop5",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "最大嵌套 4 层"
},
{
"Type": "NodeText",
"Data": ":嵌入块内的嵌入块最多递归渲染 4 层,超出部分不再展开"
}
]
}
]
},
{
"ID": "20260612202058-niuyc9c",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "My4=",
"Num": 3
},
"Properties": {
"id": "20260612202058-niuyc9c",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202058-0x1tkd6",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-0x1tkd6",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "不嵌套自身类型"
},
{
"Type": "NodeText",
"Data": ":嵌入块内部不会再次嵌入其他 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "query_embed"
},
{
"Type": "NodeText",
"Data": " 块"
}
]
}
]
},
{
"ID": "20260612202058-vuy2gbe",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NC4=",
"Num": 4
},
"Properties": {
"id": "20260612202058-vuy2gbe",
"updated": "20261016111305"
},
"Children": [
{
"ID": "20260612202058-c32za6h",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-c32za6h",
"updated": "20261016111305"
},
"Children": [
{
"Type": "NodeText",
"Data": "渲染与错误提示:返回块 ID 数组时自动渲染对应内容块,无结果时显示“引用已过期”;返回非数组时保留脚本自定义的 DOM 并结束加载;执行异常时显示实际错误信息"
}
]
}
]
},
{
"ID": "20260612202058-8zhr6r3",
"Type": "NodeListItem",
"ListData": {
"Typ": 1,
"Delimiter": 46,
"Marker": "NS4=",
"Num": 5
},
"Properties": {
"id": "20260612202058-8zhr6r3",
"updated": "20260810212846"
},
"Children": [
{
"ID": "20260612202058-qh54hmx",
"Type": "NodeParagraph",
"Properties": {
"id": "20260612202058-qh54hmx",
"updated": "20260810212846"
},
"Children": [
{
"Type": "NodeText",
"Data": "安全性"
},
{
"Type": "NodeText",
"Data": ":后端渲染/导出时会移除 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "<script>"
},
{
"Type": "NodeText",
"Data": " 标签和 "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "javascript:"
},
{
"Type": "NodeText",
"Data": " 协议等危险内容"
}
]
}
]
}
]
}
]
}