From 20b8566ed8128ad4caa8619d2049fc0a86790a20 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 11 Dec 2025 09:44:34 +0800 Subject: [PATCH 1/2] :sparkles: Callout block https://github.com/siyuan-note/siyuan/issues/16051 Signed-off-by: Daniel <845765@qq.com> --- .../20200924093441-ft2rhps.sy | 126 ++++++++++++++++-- .../20200825162036-4dx365o.sy | 126 ++++++++++++++++-- .../20211226121319-emrk2yy.sy | 126 ++++++++++++++++-- .../20240530101000-3qhz7br.sy | 126 ++++++++++++++++-- 4 files changed, 468 insertions(+), 36 deletions(-) diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy index abb2f604f..e3e36731a 100644 --- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy +++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-h361q1i/20200924093441-ft2rhps.sy @@ -8,7 +8,7 @@ "title": "Formatting elements", "title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;", "type": "doc", - "updated": "20251209212851" + "updated": "20251211094305" }, "Children": [ { @@ -1863,7 +1863,7 @@ "HeadingLevel": 2, "Properties": { "id": "20251209212851-yo274kb", - "updated": "20251209212525" + "updated": "20251211094305" }, "Children": [ { @@ -1873,27 +1873,135 @@ ] }, { - "ID": "20251209212851-q7ji9yd", + "ID": "20251211094305-py67twd", "Type": "NodeCallout", "Properties": { - "id": "20251209212851-q7ji9yd", - "updated": "20251209212537" + "id": "20251211094305-py67twd", + "updated": "20251211094305" + }, + "CalloutType": "NOTE", + "CalloutTitle": "Note", + "CalloutIcon": "✏️", + "Children": [ + { + "ID": "20251211094305-ow2t21o", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094305-ow2t21o", + "updated": "20251211094305" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "Highlights information that users should take into account, even when skimming." + } + ] + } + ] + }, + { + "ID": "20251211094305-7j529td", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094305-7j529td", + "updated": "20251211094305" + }, + "CalloutType": "TIP", + "CalloutTitle": "Tip", + "CalloutIcon": "💡", + "Children": [ + { + "ID": "20251211094305-49y1j3r", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094305-49y1j3r", + "updated": "20251211094305" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "Optional information to help a user be more successful." + } + ] + } + ] + }, + { + "ID": "20251211094305-6tapwrt", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094305-6tapwrt", + "updated": "20251211094305" }, "CalloutType": "IMPORTANT", "CalloutTitle": "Important", "CalloutIcon": "❗", "Children": [ { - "ID": "20251209212851-3iejv3r", + "ID": "20251211094305-pmwapsh", "Type": "NodeParagraph", "Properties": { - "id": "20251209212851-3iejv3r", - "updated": "20251209212547" + "id": "20251211094305-pmwapsh", + "updated": "20251211094305" }, "Children": [ { "Type": "NodeText", - "Data": "A prominent message!" + "Data": "Crucial information necessary for users to succeed." + } + ] + } + ] + }, + { + "ID": "20251211094305-kq893ph", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094305-kq893ph", + "updated": "20251211094305" + }, + "CalloutType": "WARNING", + "CalloutTitle": "Warning", + "CalloutIcon": "⚠️", + "Children": [ + { + "ID": "20251211094305-2622twh", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094305-2622twh", + "updated": "20251211094305" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "Critical content demanding immediate user attention due to potential risks." + } + ] + } + ] + }, + { + "ID": "20251211094305-bmbbwkp", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094305-bmbbwkp", + "updated": "20251211094305" + }, + "CalloutType": "CAUTION", + "CalloutTitle": "Caution", + "CalloutIcon": "🚨", + "Children": [ + { + "ID": "20251211094305-tmokbr0", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094305-tmokbr0", + "updated": "20251211094305" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "Negative potential consequences of an action." } ] } diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy index 056777d71..29c979e78 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-abz7w6k/20200825162036-4dx365o.sy @@ -8,7 +8,7 @@ "title": "排版元素", "title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);", "type": "doc", - "updated": "20251209210844" + "updated": "20251211094029" }, "Children": [ { @@ -1866,7 +1866,7 @@ "HeadingLevel": 2, "Properties": { "id": "20251209210844-rap5wy6", - "updated": "20251209210302" + "updated": "20251211094029" }, "Children": [ { @@ -1876,27 +1876,135 @@ ] }, { - "ID": "20251209210844-5fa4e8p", + "ID": "20251211093951-xtkv05z", "Type": "NodeCallout", "Properties": { - "id": "20251209210844-5fa4e8p", - "updated": "20251209210419" + "id": "20251211093951-xtkv05z", + "updated": "20251211094016" + }, + "CalloutType": "NOTE", + "CalloutTitle": "Note", + "CalloutIcon": "✏️", + "Children": [ + { + "ID": "20251211093951-ywyj5yp", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211093951-ywyj5yp", + "updated": "20251211094016" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "突出显示即使快速浏览也应注意的信息。" + } + ] + } + ] + }, + { + "ID": "20251211093951-olg8lvt", + "Type": "NodeCallout", + "Properties": { + "id": "20251211093951-olg8lvt", + "updated": "20251211094019" + }, + "CalloutType": "TIP", + "CalloutTitle": "Tip", + "CalloutIcon": "💡", + "Children": [ + { + "ID": "20251211093951-nny14nk", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211093951-nny14nk", + "updated": "20251211094019" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "可选信息,有助于更顺利地完成任务。" + } + ] + } + ] + }, + { + "ID": "20251211093951-k74y9ge", + "Type": "NodeCallout", + "Properties": { + "id": "20251211093951-k74y9ge", + "updated": "20251211094024" }, "CalloutType": "IMPORTANT", "CalloutTitle": "Important", "CalloutIcon": "❗", "Children": [ { - "ID": "20251209210844-h3sp774", + "ID": "20251211093951-8rjh25b", "Type": "NodeParagraph", "Properties": { - "id": "20251209210844-h3sp774", - "updated": "20251209210628" + "id": "20251211093951-8rjh25b", + "updated": "20251211094024" }, "Children": [ { "Type": "NodeText", - "Data": "醒目的提示!" + "Data": "成功完成任务所必需的关键信息。" + } + ] + } + ] + }, + { + "ID": "20251211093951-580y2vk", + "Type": "NodeCallout", + "Properties": { + "id": "20251211093951-580y2vk", + "updated": "20251211094029" + }, + "CalloutType": "WARNING", + "CalloutTitle": "Warning", + "CalloutIcon": "⚠️", + "Children": [ + { + "ID": "20251211093951-l5o9hoe", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211093951-l5o9hoe", + "updated": "20251211094029" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "由于存在潜在风险,此重要内容需要立即关注。" + } + ] + } + ] + }, + { + "ID": "20251211093951-fe1g5ac", + "Type": "NodeCallout", + "Properties": { + "id": "20251211093951-fe1g5ac", + "updated": "20251211093951" + }, + "CalloutType": "CAUTION", + "CalloutTitle": "Caution", + "CalloutIcon": "🚨", + "Children": [ + { + "ID": "20251211093951-ppbnywx", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211093951-ppbnywx", + "updated": "20251211093951" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "某项操作可能带来的负面后果。" } ] } diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy index cbf0434dd..022f812e8 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226120854-dr1jfx2/20211226121319-emrk2yy.sy @@ -8,7 +8,7 @@ "title": "排版元素", "title-img": "background-color: hsl(2, 57%, 40%);background-image: repeating-linear-gradient(transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(270deg, transparent, transparent 50px, rgba(0,0,0,.4) 50px, rgba(0,0,0,.4) 53px, transparent 53px, transparent 63px, rgba(0,0,0,.4) 63px, rgba(0,0,0,.4) 66px, transparent 66px, transparent 116px, rgba(0,0,0,.5) 116px, rgba(0,0,0,.5) 166px, rgba(255,255,255,.2) 166px, rgba(255,255,255,.2) 169px, rgba(0,0,0,.5) 169px, rgba(0,0,0,.5) 179px, rgba(255,255,255,.2) 179px, rgba(255,255,255,.2) 182px, rgba(0,0,0,.5) 182px, rgba(0,0,0,.5) 232px, transparent 232px),repeating-linear-gradient(125deg, transparent, transparent 2px, rgba(0,0,0,.2) 2px, rgba(0,0,0,.2) 3px, transparent 3px, transparent 5px, rgba(0,0,0,.2) 5px);", "type": "doc", - "updated": "20251209211701" + "updated": "20251211094201" }, "Children": [ { @@ -1864,7 +1864,7 @@ "HeadingLevel": 2, "Properties": { "id": "20251209211701-hu8m4pm", - "updated": "20251209211421" + "updated": "20251211094201" }, "Children": [ { @@ -1874,27 +1874,135 @@ ] }, { - "ID": "20251209211701-958yoox", + "ID": "20251211094143-aymafj0", "Type": "NodeCallout", "Properties": { - "id": "20251209211701-958yoox", - "updated": "20251209211426" + "id": "20251211094143-aymafj0", + "updated": "20251211094150" + }, + "CalloutType": "NOTE", + "CalloutTitle": "Note", + "CalloutIcon": "✏️", + "Children": [ + { + "ID": "20251211094143-df00ss1", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094143-df00ss1", + "updated": "20251211094150" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "反白顯示即使快速瀏覽也應注意的資訊。" + } + ] + } + ] + }, + { + "ID": "20251211094143-tfdwvoe", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094143-tfdwvoe", + "updated": "20251211094152" + }, + "CalloutType": "TIP", + "CalloutTitle": "Tip", + "CalloutIcon": "💡", + "Children": [ + { + "ID": "20251211094143-jgbn677", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094143-jgbn677", + "updated": "20251211094152" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "幫助取得更大成功的選用資訊。" + } + ] + } + ] + }, + { + "ID": "20251211094143-zst3xpn", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094143-zst3xpn", + "updated": "20251211094157" }, "CalloutType": "IMPORTANT", "CalloutTitle": "Important", "CalloutIcon": "❗", "Children": [ { - "ID": "20251209211701-q3z8lo2", + "ID": "20251211094143-91vr3mm", "Type": "NodeParagraph", "Properties": { - "id": "20251209211701-q3z8lo2", - "updated": "20251209211442" + "id": "20251211094143-91vr3mm", + "updated": "20251211094157" }, "Children": [ { "Type": "NodeText", - "Data": "醒目的提示!" + "Data": "成功所必需的關鍵資訊。" + } + ] + } + ] + }, + { + "ID": "20251211094143-vij9zby", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094143-vij9zby", + "updated": "20251211094201" + }, + "CalloutType": "WARNING", + "CalloutTitle": "Warning", + "CalloutIcon": "⚠️", + "Children": [ + { + "ID": "20251211094143-xt5f7c4", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094143-xt5f7c4", + "updated": "20251211094201" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "由於潛在風險,需要立即關注的關鍵內容。" + } + ] + } + ] + }, + { + "ID": "20251211094143-1kho5im", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094143-1kho5im", + "updated": "20251211094143" + }, + "CalloutType": "CAUTION", + "CalloutTitle": "Caution", + "CalloutIcon": "🚨", + "Children": [ + { + "ID": "20251211094143-s8sta3t", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094143-s8sta3t", + "updated": "20251211094143" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "操作可能帶來的負面後果。" } ] } diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy index c80b6bac8..20ffc0e3e 100644 --- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy +++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-hnu6o79/20240530101000-3qhz7br.sy @@ -9,7 +9,7 @@ "title": "書式要素", "title-img": "background-color:#269;background-image: linear-gradient(white 2px, transparent 2px),linear-gradient(90deg, white 2px, transparent 2px),linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px);background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px;", "type": "doc", - "updated": "20251209213443" + "updated": "20251211094239" }, "Children": [ { @@ -2015,7 +2015,7 @@ "HeadingLevel": 2, "Properties": { "id": "20251209213443-j5jhozb", - "updated": "20251209213325" + "updated": "20251211094239" }, "Children": [ { @@ -2025,27 +2025,135 @@ ] }, { - "ID": "20251209213443-iono8bm", + "ID": "20251211094239-hhtrwax", "Type": "NodeCallout", "Properties": { - "id": "20251209213443-iono8bm", - "updated": "20251209213308" + "id": "20251211094239-hhtrwax", + "updated": "20251211094239" + }, + "CalloutType": "NOTE", + "CalloutTitle": "Note", + "CalloutIcon": "✏️", + "Children": [ + { + "ID": "20251211094239-8ahrdao", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094239-8ahrdao", + "updated": "20251211094239" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "ユーザーがざっと目を通す場合でも考慮すべき情報を強調表示します。" + } + ] + } + ] + }, + { + "ID": "20251211094239-ratz2rv", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094239-ratz2rv", + "updated": "20251211094239" + }, + "CalloutType": "TIP", + "CalloutTitle": "Tip", + "CalloutIcon": "💡", + "Children": [ + { + "ID": "20251211094239-3a7eude", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094239-3a7eude", + "updated": "20251211094239" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "ユーザーの作業効率を高めるための補足情報です。" + } + ] + } + ] + }, + { + "ID": "20251211094239-rnlp7y4", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094239-rnlp7y4", + "updated": "20251211094239" }, "CalloutType": "IMPORTANT", "CalloutTitle": "Important", "CalloutIcon": "❗", "Children": [ { - "ID": "20251209213443-y1n0smi", + "ID": "20251211094239-xq36ase", "Type": "NodeParagraph", "Properties": { - "id": "20251209213443-y1n0smi", - "updated": "20251209213307" + "id": "20251211094239-xq36ase", + "updated": "20251211094239" }, "Children": [ { "Type": "NodeText", - "Data": "目立つメッセージです!" + "Data": "ユーザーが作業を成功させるために必要な重要な情報です。" + } + ] + } + ] + }, + { + "ID": "20251211094239-ck7ejz3", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094239-ck7ejz3", + "updated": "20251211094239" + }, + "CalloutType": "WARNING", + "CalloutTitle": "Warning", + "CalloutIcon": "⚠️", + "Children": [ + { + "ID": "20251211094239-q5nl8va", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094239-q5nl8va", + "updated": "20251211094239" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "潜在的なリスクがあるため、ユーザーが直ちに注意を払う必要がある重要な内容です。" + } + ] + } + ] + }, + { + "ID": "20251211094239-8enlxly", + "Type": "NodeCallout", + "Properties": { + "id": "20251211094239-8enlxly", + "updated": "20251211094239" + }, + "CalloutType": "CAUTION", + "CalloutTitle": "Caution", + "CalloutIcon": "🚨", + "Children": [ + { + "ID": "20251211094239-3wa1x7f", + "Type": "NodeParagraph", + "Properties": { + "id": "20251211094239-3wa1x7f", + "updated": "20251211094239" + }, + "Children": [ + { + "Type": "NodeText", + "Data": "ある行動によって生じる可能性のある負の結果を示します。" } ] } From 25ca3be12620bcae5ea75d6958c7a6bee0b201c0 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 11 Dec 2025 10:26:03 +0800 Subject: [PATCH 2/2] :art: Improve the behavior of `Jump to parent block` in lists https://github.com/siyuan-note/siyuan/issues/16516 Signed-off-by: Daniel <845765@qq.com> --- kernel/model/block.go | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/kernel/model/block.go b/kernel/model/block.go index 1425cb146..58b17572e 100644 --- a/kernel/model/block.go +++ b/kernel/model/block.go @@ -249,28 +249,18 @@ func GetBlockSiblingID(id string) (parent, previous, next string) { } break } - parent = treenode.FirstLeafBlock(parentBlock).ID - - parentBlock = treenode.ParentBlock(current) - for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) { - if nil != parentBlock.Previous && parentBlock.Previous.IsBlock() { - previous = parentBlock.Previous.ID - if flb := treenode.FirstChildBlock(parentBlock.Previous); nil != flb { - previous = flb.ID - } - break - } + if ast.NodeDocument == parentBlock.Type { + parentBlock = treenode.FirstLeafBlock(parentBlock) + parent = parentBlock.ID + } else { + parent = parentBlock.ID } - parentBlock = treenode.ParentBlock(current) - for ; nil != parentBlock; parentBlock = treenode.ParentBlock(parentBlock) { - if nil != parentBlock.Next && parentBlock.Next.IsBlock() { - next = parentBlock.Next.ID - if flb := treenode.FirstChildBlock(parentBlock.Next); nil != flb { - next = flb.ID - } - break - } + if nil != parentBlock.Previous { + previous = parentBlock.Previous.ID + } + if nil != parentBlock.Next { + next = parentBlock.Next.ID } return }