Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-09-16 20:18:20 +08:00
commit 4229e68434
25 changed files with 527 additions and 474 deletions

View file

@ -7,7 +7,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": "20220909095340"
"updated": "20220916200115"
},
"Children": [
{
@ -31,7 +31,7 @@
"ListData": {},
"Properties": {
"id": "20210104091509-8csaq4j",
"updated": "20220521234603"
"updated": "20220916200115"
},
"Children": [
{
@ -55,33 +55,11 @@
},
"Children": [
{
"Type": "NodeBlockRef",
"Data": "span",
"Children": [
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeBlockRefID",
"Data": "20200923234011-ieuun1p"
},
{
"Type": "NodeBlockRefSpace"
},
{
"Type": "NodeBlockRefText",
"Data": "Please Start Here"
},
{
"Type": "NodeCloseParen"
},
{
"Type": "NodeCloseParen"
}
]
"Type": "NodeTextMark",
"TextMarkType": "block-ref",
"TextMarkBlockRefID": "20200923234011-ieuun1p",
"TextMarkBlockRefSubtype": "s",
"TextMarkTextContent": "Please Start Here"
}
]
}
@ -112,6 +90,92 @@
"TextMarkType": "a",
"TextMarkAHref": "https://ld246.com",
"TextMarkTextContent": "Hyperlink"
}
]
}
]
},
{
"ID": "20220916200111-8pnrqr2",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220916200111-8pnrqr2",
"updated": "20220916200115"
},
"Children": [
{
"ID": "20220916200111-4swvak0",
"Type": "NodeParagraph",
"Properties": {
"id": "20220916200111-4swvak0",
"updated": "20220916200114"
},
"Children": [
{
"Type": "NodeText",
"Data": "Picture"
}
]
},
{
"ID": "20210604225055-4pq8g38",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604225055-4pq8g38",
"updated": "20210604225153"
},
"Children": [
{
"Type": "NodeText",
"Data": "Support direct copy and paste or drag and upload. After uploading, you can adjust the size by dragging the sidebar."
}
]
},
{
"ID": "20220916200115-rstez65",
"Type": "NodeParagraph",
"Properties": {
"id": "20220916200115-rstez65"
},
"Children": [
{
"Type": "NodeImage",
"Data": "span",
"Properties": {
"style": "display: block;"
},
"Children": [
{
"Type": "NodeBang"
},
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "assets/siyuan-128-20210604092437-7iqzf90.png"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeKramdownSpanIAL",
"Data": "{: style=\"display: block;\"}"
},
{
"Type": "NodeText",
@ -432,6 +496,10 @@
"Type": "NodeTextMark",
"TextMarkType": "inline-math",
"TextMarkInlineMathContent": "a^2 + b^2 = \\color{red}c^2"
},
{
"Type": "NodeText",
"Data": "\n"
}
]
}
@ -742,80 +810,6 @@
}
]
},
{
"ID": "20210104091509-xzmngg2",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20210104091509-xzmngg2",
"updated": "20210415200914"
},
"Children": [
{
"Type": "NodeText",
"Data": "Pictures"
}
]
},
{
"ID": "20210604225055-4pq8g38",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604225055-4pq8g38",
"updated": "20210604225153"
},
"Children": [
{
"Type": "NodeText",
"Data": "Support direct copy and paste or drag and upload. After uploading, you can adjust the size by dragging the sidebar."
}
]
},
{
"ID": "20210604225041-9i92rk2",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604225041-9i92rk2",
"updated": "20210604225041"
},
"Children": [
{
"Type": "NodeImage",
"Data": "span",
"Properties": {
"style": "display: block;"
},
"Children": [
{
"Type": "NodeBang"
},
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "assets/siyuan-128-20210604092437-7iqzf90.png"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": "\n"
}
]
},
{
"ID": "20210604225457-qsanq8c",
"Type": "NodeHeading",

View file

@ -7,7 +7,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": "20220908200902"
"updated": "20210604222204"
},
"Children": [
{
@ -16,12 +16,12 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210604182832-nm3hapx",
"updated": "20210604183630"
"updated": "20220916194920"
},
"Children": [
{
"Type": "NodeText",
"Data": "行元素"
"Data": "行元素"
}
]
},
@ -31,7 +31,7 @@
"ListData": {},
"Properties": {
"id": "20210104091228-ttcj9nm",
"updated": "20220521234027"
"updated": "20210604222204"
},
"Children": [
{
@ -55,33 +55,11 @@
},
"Children": [
{
"Type": "NodeBlockRef",
"Data": "span",
"Children": [
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeBlockRefID",
"Data": "20200812220555-lj3enxa"
},
{
"Type": "NodeBlockRefSpace"
},
{
"Type": "NodeBlockRefText",
"Data": "请从这里开始"
},
{
"Type": "NodeCloseParen"
},
{
"Type": "NodeCloseParen"
}
]
"Type": "NodeTextMark",
"TextMarkType": "block-ref",
"TextMarkBlockRefID": "20200812220555-lj3enxa",
"TextMarkBlockRefSubtype": "s",
"TextMarkTextContent": "请从这里开始"
}
]
}
@ -112,10 +90,97 @@
"TextMarkType": "a",
"TextMarkAHref": "https://ld246.com",
"TextMarkTextContent": "超级链接"
}
]
}
]
},
{
"ID": "20220916195046-bdzv6fy",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220916195046-bdzv6fy",
"updated": "20210604222204"
},
"Children": [
{
"ID": "20220916195046-oy8nve3",
"Type": "NodeParagraph",
"Properties": {
"id": "20220916195046-oy8nve3",
"updated": "20220916195047"
},
"Children": [
{
"Type": "NodeText",
"Data": "图片"
}
]
},
{
"ID": "20210604222221-9zkgkky",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604222221-9zkgkky",
"updated": "20220916195051"
},
"Children": [
{
"Type": "NodeText",
"Data": "可通过复制粘贴或拖拽来上传图片;上传后的图片可通过拖拽进行大小调整。"
}
]
},
{
"ID": "20210604222158-w17nnmy",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604222158-w17nnmy",
"updated": "20210604222204"
},
"Children": [
{
"Type": "NodeImage",
"Data": "span",
"Properties": {
"style": "display: block;"
},
"Children": [
{
"Type": "NodeBang"
},
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "assets/siyuan-128-20210604092205-djd749a.png"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeBr",
"Data": "br"
"Type": "NodeKramdownSpanIAL",
"Data": "{: style=\"display: block;\"}"
},
{
"Type": "NodeText",
"Data": "\n"
}
]
}
@ -399,13 +464,13 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20210201202130-085324n",
"updated": "20210604221052"
"updated": "20220916195010"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "行代码"
"TextMarkTextContent": "行代码"
}
]
}
@ -435,6 +500,10 @@
"Type": "NodeTextMark",
"TextMarkType": "inline-math",
"TextMarkInlineMathContent": "a^2 + b^2 = \\color{red}c^2"
},
{
"Type": "NodeText",
"Data": "\n"
}
]
}
@ -749,80 +818,6 @@
}
]
},
{
"ID": "20210104091228-lft5b4z",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20210104091228-lft5b4z",
"updated": "20210604222220"
},
"Children": [
{
"Type": "NodeText",
"Data": "图片 "
}
]
},
{
"ID": "20210604222221-9zkgkky",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604222221-9zkgkky",
"updated": "20210604222341"
},
"Children": [
{
"Type": "NodeText",
"Data": "可通过复制粘贴或拖拽来上传图片;上传后的图片可通过拖拽进行大小调整。"
}
]
},
{
"ID": "20210604222158-w17nnmy",
"Type": "NodeParagraph",
"Properties": {
"id": "20210604222158-w17nnmy",
"updated": "20210604222204"
},
"Children": [
{
"Type": "NodeImage",
"Data": "span",
"Properties": {
"style": "display: block;"
},
"Children": [
{
"Type": "NodeBang"
},
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "assets/siyuan-128-20210604092205-djd749a.png"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeText",
"Data": "\n"
}
]
},
{
"ID": "20210604183450-fybakeg",
"Type": "NodeHeading",

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20220628204444-9n0y9h2",
"title": "优化排版",
"updated": "20220630211109"
"updated": "20220916195228"
},
"Children": [
{
@ -38,15 +38,21 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220628204604-qom7yyl",
"updated": "20220628205230"
"updated": "20220916195228"
},
"Children": [
{
"Type": "NodeText",
"Data": "为了快速记录内容,我们时常会忽略一些排版细节,比如行内代码前后或者加粗前后缺少空格、中文和西文之间缺少空格。",
"Properties": {
"id": ""
}
"Data": "为了快速记录内容,我们时常会忽略一些排版细节,比如"
},
{
"Type": "NodeTextMark",
"TextMarkType": "search-mark",
"TextMarkTextContent": "行"
},
{
"Type": "NodeText",
"Data": "级代码前后或者加粗前后缺少空格、中文和西文之间缺少空格。"
}
]
},
@ -142,7 +148,7 @@
"ListData": {},
"Properties": {
"id": "20220628205832-odovge3",
"updated": "20220628210303"
"updated": "20220916195220"
},
"Children": [
{
@ -154,7 +160,7 @@
},
"Properties": {
"id": "20220628205833-kmfuhsp",
"updated": "20220628205833"
"updated": "20220916195218"
},
"Children": [
{
@ -162,12 +168,17 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220628205833-iu4yxrq",
"updated": "20220628205855"
"updated": "20220916195218"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "search-mark",
"TextMarkTextContent": "行"
},
{
"Type": "NodeText",
"Data": "行内代码"
"Data": "代码"
}
]
}
@ -182,7 +193,7 @@
},
"Properties": {
"id": "20220628205855-jp2ks1q",
"updated": "20220628210128"
"updated": "20220916195220"
},
"Children": [
{
@ -190,12 +201,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220628205855-1gfuu51",
"updated": "20220628210245"
"updated": "20220916195220"
},
"Children": [
{
"Type": "NodeText",
"Data": "行公式"
"Data": "行公式"
}
]
}

View file

@ -7,7 +7,7 @@
"id": "20200813004551-gm0pbn1",
"title": "快捷键",
"type": "doc",
"updated": "20220904093144"
"updated": "20220916195306"
},
"Children": [
{
@ -1657,7 +1657,7 @@
"Properties": {
"colgroup": "||",
"id": "20201227133317-vopotjc",
"updated": "20220904093101"
"updated": "20220916195306"
},
"Children": [
{
@ -4056,7 +4056,7 @@
"Children": [
{
"Type": "NodeText",
"Data": "光标在行元素中唤起对应的功能菜单,否则唤起块菜单"
"Data": "光标在行元素中唤起对应的功能菜单,否则唤起块菜单"
}
]
}
@ -4129,7 +4129,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Ctrl+Shift+\u003e"
"TextMarkTextContent": "Ctrl+Shift+\u0026gt;"
},
{
"Type": "NodeText",
@ -4138,7 +4138,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⇧⌘\u003e"
"TextMarkTextContent": "⇧⌘\u0026gt;"
}
]
},
@ -4551,7 +4551,7 @@
"Properties": {
"colgroup": "||",
"id": "20210102174148-snb76bj",
"updated": "20220618235728"
"updated": "20220916195234"
},
"Children": [
{
@ -4974,7 +4974,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Ctrl+'"
"TextMarkTextContent": "Ctrl+\u0026apos;"
},
{
"Type": "NodeText",
@ -4983,7 +4983,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⌘'"
"TextMarkTextContent": "⌘\u0026apos;"
}
]
},
@ -5041,9 +5041,14 @@
"Type": "NodeTableCell",
"Data": "td",
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "search-mark",
"TextMarkTextContent": "行"
},
{
"Type": "NodeText",
"Data": "行内数学公式"
"Data": "数学公式"
}
]
},
@ -5255,7 +5260,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "\u003e"
"TextMarkTextContent": "\u0026gt;"
}
]
},

View file

@ -6,7 +6,7 @@
"id": "20211226121319-emrk2yy",
"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);",
"updated": "20220909095422"
"updated": "20220916195925"
},
"Children": [
{
@ -15,12 +15,12 @@
"HeadingLevel": 2,
"Properties": {
"id": "20211226122008-i45akvs",
"updated": "20211226122008"
"updated": "20220916195925"
},
"Children": [
{
"Type": "NodeText",
"Data": "行元素"
"Data": "行元素"
}
]
},
@ -30,7 +30,7 @@
"ListData": {},
"Properties": {
"id": "20211226122008-1e014nh",
"updated": "20220521234434"
"updated": "20220916195740"
},
"Children": [
{
@ -54,33 +54,11 @@
},
"Children": [
{
"Type": "NodeBlockRef",
"Data": "span",
"Children": [
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeBlockRefID",
"Data": "20211226115423-d5z1joq"
},
{
"Type": "NodeBlockRefSpace"
},
{
"Type": "NodeBlockRefText",
"Data": "請從這裡開始"
},
{
"Type": "NodeCloseParen"
},
{
"Type": "NodeCloseParen"
}
]
"Type": "NodeTextMark",
"TextMarkType": "block-ref",
"TextMarkBlockRefID": "20211226115423-d5z1joq",
"TextMarkBlockRefSubtype": "s",
"TextMarkTextContent": "請從這裡開始"
}
]
}
@ -116,6 +94,97 @@
}
]
},
{
"ID": "20220916195409-g57vfyf",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20220916195409-g57vfyf",
"updated": "20211226122008"
},
"Children": [
{
"ID": "20220916195414-a5jqqzy",
"Type": "NodeParagraph",
"Properties": {
"id": "20220916195414-a5jqqzy",
"updated": "20220916195414"
},
"Children": [
{
"Type": "NodeText",
"Data": "圖片"
}
]
},
{
"ID": "20211226122008-pei037e",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226122008-pei037e",
"updated": "20220916195424"
},
"Children": [
{
"Type": "NodeText",
"Data": "可通過複制貼上或拖拽來上傳圖片;上傳後的圖片可通過拖拽進行大小調整。"
}
]
},
{
"ID": "20211226122008-poajwbi",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226122008-poajwbi",
"updated": "20210604222204"
},
"Children": [
{
"Type": "NodeImage",
"Data": "span",
"Properties": {
"style": "display: block;"
},
"Children": [
{
"Type": "NodeBang"
},
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "assets/siyuan-128-20210604092205-djd749a.png"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeKramdownSpanIAL",
"Data": "{: style=\"display: block;\"}"
},
{
"Type": "NodeText",
"Data": "\n"
}
]
}
]
},
{
"ID": "20211226122008-aswl5xl",
"Type": "NodeListItem",
@ -390,7 +459,7 @@
},
"Properties": {
"id": "20211226122008-dwvi51s",
"updated": "20211226122008"
"updated": "20220916195740"
},
"Children": [
{
@ -398,13 +467,13 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20211226122008-f8vr0tu",
"updated": "20211226122008"
"updated": "20220916195740"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "code",
"TextMarkTextContent": "行代碼"
"TextMarkTextContent": "行代碼"
}
]
}
@ -748,84 +817,6 @@
}
]
},
{
"ID": "20211226122008-s3rfg01",
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20211226122008-s3rfg01",
"updated": "20211226122008"
},
"Children": [
{
"Type": "NodeText",
"Data": "圖片"
}
]
},
{
"ID": "20211226122008-pei037e",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226122008-pei037e",
"updated": "20211226002011"
},
"Children": [
{
"Type": "NodeText",
"Data": "可通過複制貼上或拖拽來上傳圖片;上傳後的圖片可通過拖拽進行大小調整。"
}
]
},
{
"ID": "20211226122008-poajwbi",
"Type": "NodeParagraph",
"Properties": {
"id": "20211226122008-poajwbi",
"updated": "20210604222204"
},
"Children": [
{
"Type": "NodeImage",
"Data": "span",
"Properties": {
"style": "display: block;"
},
"Children": [
{
"Type": "NodeBang"
},
{
"Type": "NodeOpenBracket"
},
{
"Type": "NodeLinkText"
},
{
"Type": "NodeCloseBracket"
},
{
"Type": "NodeOpenParen"
},
{
"Type": "NodeLinkDest",
"Data": "assets/siyuan-128-20210604092205-djd749a.png"
},
{
"Type": "NodeCloseParen"
}
]
},
{
"Type": "NodeKramdownSpanIAL",
"Data": "{: style=\"display: block;\"}"
},
{
"Type": "NodeText",
"Data": "\n"
}
]
},
{
"ID": "20211226122008-nufcprx",
"Type": "NodeHeading",

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20220628204420-ui79vkt",
"title": "優化排版",
"updated": "20220630211154"
"updated": "20220916195825"
},
"Children": [
{
@ -28,12 +28,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220628215506-karsxdt",
"updated": "20220628215506"
"updated": "20220916195825"
},
"Children": [
{
"Type": "NodeText",
"Data": "為了快速記錄內容,我們時常會忽略一些排版細節,比如行代碼前後或者加粗前後缺少空格、中文和西文之間缺少空格。"
"Data": "為了快速記錄內容,我們時常會忽略一些排版細節,比如行代碼前後或者加粗前後缺少空格、中文和西文之間缺少空格。"
}
]
},
@ -104,7 +104,7 @@
"ListData": {},
"Properties": {
"id": "20220628215506-srlvfe0",
"updated": "20220628215506"
"updated": "20220916195816"
},
"Children": [
{
@ -116,7 +116,7 @@
},
"Properties": {
"id": "20220628215506-tfhl45j",
"updated": "20220628215506"
"updated": "20220916195816"
},
"Children": [
{
@ -124,12 +124,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220628215506-c6atyjn",
"updated": "20220628215506"
"updated": "20220916195816"
},
"Children": [
{
"Type": "NodeText",
"Data": "行代碼"
"Data": "行代碼"
}
]
}
@ -144,7 +144,7 @@
},
"Properties": {
"id": "20220628215506-258fpgt",
"updated": "20220628215506"
"updated": "20220916195814"
},
"Children": [
{
@ -152,12 +152,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20220628215506-3twrnze",
"updated": "20220628215506"
"updated": "20220916195814"
},
"Children": [
{
"Type": "NodeText",
"Data": "行公式"
"Data": "行公式"
}
]
}

View file

@ -6,7 +6,7 @@
"icon": "2328",
"id": "20211226122549-jktxego",
"title": "快捷鍵",
"updated": "20220904093830"
"updated": "20220916195834"
},
"Children": [
{
@ -1645,7 +1645,7 @@
"Properties": {
"colgroup": "||",
"id": "20211226122652-pb50zx4",
"updated": "20220904093734"
"updated": "20220916195834"
},
"Children": [
{
@ -4048,7 +4048,7 @@
"Children": [
{
"Type": "NodeText",
"Data": "光標在行元素中喚起對應的功能菜單,否則喚起塊菜單"
"Data": "光標在行元素中喚起對應的功能菜單,否則喚起塊菜單"
},
{
"Type": "NodeBr",
@ -4133,7 +4133,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Ctrl+Shift+\u003e"
"TextMarkTextContent": "Ctrl+Shift+\u0026gt;"
},
{
"Type": "NodeText",
@ -4142,7 +4142,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⇧⌘\u003e"
"TextMarkTextContent": "⇧⌘\u0026gt;"
}
]
},
@ -4289,7 +4289,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設置-\u003e快捷鍵"
"TextMarkTextContent": "設置-\u0026gt;快捷鍵"
},
{
"Type": "NodeText",
@ -4334,7 +4334,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設置-\u003e快捷鍵"
"TextMarkTextContent": "設置-\u0026gt;快捷鍵"
},
{
"Type": "NodeText",
@ -4379,7 +4379,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設置-\u003e快捷鍵"
"TextMarkTextContent": "設置-\u0026gt;快捷鍵"
},
{
"Type": "NodeText",
@ -4424,7 +4424,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設置-\u003e快捷鍵"
"TextMarkTextContent": "設置-\u0026gt;快捷鍵"
},
{
"Type": "NodeText",
@ -4469,7 +4469,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設置-\u003e快捷鍵"
"TextMarkTextContent": "設置-\u0026gt;快捷鍵"
},
{
"Type": "NodeText",
@ -4514,7 +4514,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "設置-\u003e快捷鍵"
"TextMarkTextContent": "設置-\u0026gt;快捷鍵"
},
{
"Type": "NodeText",
@ -4552,7 +4552,7 @@
"Properties": {
"colgroup": "||",
"id": "20211226122652-v6as45b",
"updated": "20220518105130"
"updated": "20220916195647"
},
"Children": [
{
@ -4975,7 +4975,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Ctrl+'"
"TextMarkTextContent": "Ctrl+\u0026apos;"
},
{
"Type": "NodeText",
@ -4984,7 +4984,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "⌘'"
"TextMarkTextContent": "⌘\u0026apos;"
}
]
},
@ -5044,7 +5044,7 @@
"Children": [
{
"Type": "NodeText",
"Data": "行數學公式"
"Data": "行數學公式"
}
]
},
@ -5277,7 +5277,7 @@
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "\u003e"
"TextMarkTextContent": "\u0026gt;"
}
]
},

File diff suppressed because one or more lines are too long

View file

@ -55,7 +55,7 @@ func refreshFiletree(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
model.RefreshFileTree()
model.FullReindex()
}
func doc2Heading(c *gin.Context) {

View file

@ -213,7 +213,7 @@ func setSearch(c *gin.Context) {
model.Conf.Save()
sql.SetCaseSensitive(s.CaseSensitive)
if s.CaseSensitive != oldCaseSensitive {
model.RefreshFileTree()
model.FullReindex()
}
sql.ClearVirtualRefKeywords()
ret.Data = s

View file

@ -7,7 +7,7 @@ require (
github.com/88250/css v0.1.2
github.com/88250/flock v0.8.2
github.com/88250/gulu v1.2.3-0.20220916075322-eb117059d70a
github.com/88250/lute v1.7.5-0.20220916031248-441b66b72883
github.com/88250/lute v1.7.5-0.20220916090743-91ee79ea1ba7
github.com/88250/pdfcpu v0.3.13
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ConradIrwin/font v0.0.0-20210318200717-ce8d41cc0732

View file

@ -19,8 +19,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS
github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20220916075322-eb117059d70a h1:qQdnk8clbgA+MXtf5bXOTOby32iQYjqMOn6oBIMV/Tk=
github.com/88250/gulu v1.2.3-0.20220916075322-eb117059d70a/go.mod h1:I1qBzsksFL2ciGSuqDE7R3XW4BUMrfDgOvSXEk7FsAI=
github.com/88250/lute v1.7.5-0.20220916031248-441b66b72883 h1:7uCW8I6P5934DhzUpJmZcaanRl8ws+X76sw4uca4gRM=
github.com/88250/lute v1.7.5-0.20220916031248-441b66b72883/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
github.com/88250/lute v1.7.5-0.20220916090743-91ee79ea1ba7 h1:ddXXCU+Np3iJoFV34NShb/NwaSrnG+9ZGonxd5SdJow=
github.com/88250/lute v1.7.5-0.20220916090743-91ee79ea1ba7/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA=
github.com/88250/pdfcpu v0.3.13 h1:touMWMZkCGalMIbEg9bxYp7rETM+zwb9hXjwhqi4I7Q=
github.com/88250/pdfcpu v0.3.13/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -483,10 +483,10 @@ func ReindexTree(path string) (err error) {
return
}
func RefreshFileTree() {
func FullReindex() {
util.PushEndlessProgress(Conf.Language(35))
WaitForWritingFiles()
util.PushEndlessProgress(Conf.Language(35))
if err := sql.InitDatabase(true); nil != err {
util.PushErrMsg(fmt.Sprintf(Conf.Language(85), err), 5000)
return

View file

@ -1117,27 +1117,22 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros bool) (ret *parse.T
return ast.WalkSkipChildren
}
if ast.NodeBlockRef != n.Type {
if !treenode.IsBlockRef(n) {
return ast.WalkContinue
}
// 处理引用节点
var linkText string
id := n.ChildByType(ast.NodeBlockRefID).TokensStr()
if anchor := n.ChildByType(ast.NodeBlockRefText); nil != anchor {
linkText = anchor.Text()
} else if anchor = n.ChildByType(ast.NodeBlockRefDynamicText); nil != anchor {
linkText = anchor.Text()
} else {
linkText = sql.GetRefText(id)
defID, linkText, _ := treenode.GetBlockRef(n)
if "" == linkText {
linkText = sql.GetRefText(defID)
}
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(linkText) {
linkText = gulu.Str.SubStr(linkText, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
}
linkText = Conf.Export.BlockRefTextLeft + linkText + Conf.Export.BlockRefTextRight
defTree, _ := loadTreeByBlockID(id)
defTree, _ := loadTreeByBlockID(defID)
if nil == defTree {
return ast.WalkContinue
}
@ -1150,13 +1145,12 @@ func exportTree(tree *parse.Tree, wysiwyg, expandKaTexMacros bool) (ret *parse.T
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeLinkText, Tokens: []byte(linkText)})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte("siyuan://blocks/" + id)})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte("siyuan://blocks/" + defID)})
blockRefLink.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
n.InsertBefore(blockRefLink)
case 3: // 仅锚文本
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)})
case 4: // 脚注
defID := n.ChildByType(ast.NodeBlockRefID).TokensStr()
refFoot := getRefAsFootnotes(defID, &refFootnotes)
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: []byte(linkText)})
n.InsertBefore(&ast.Node{Type: ast.NodeFootnotesRef, Tokens: []byte("^" + refFoot.refNum), FootnotesRefId: refFoot.refNum, FootnotesRefLabel: []byte("^" + refFoot.refNum)})
@ -1295,8 +1289,8 @@ func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, rootID string) (footn
return ast.WalkContinue
}
if ast.NodeBlockRef == n.Type {
defID := n.ChildByType(ast.NodeBlockRefID).TokensStr()
if treenode.IsBlockRef(n) {
defID, _, _ := treenode.GetBlockRef(n)
if f := getRefAsFootnotes(defID, refFootnotes); nil != f {
n.InsertBefore(&ast.Node{Type: ast.NodeText, Tokens: []byte(Conf.Export.BlockRefTextLeft + f.refAnchorText + Conf.Export.BlockRefTextRight)})
n.InsertBefore(&ast.Node{Type: ast.NodeFootnotesRef, Tokens: []byte("^" + f.refNum), FootnotesRefId: f.refNum, FootnotesRefLabel: []byte("^" + f.refNum)})
@ -1412,8 +1406,8 @@ func collectFootnotesDefs0(node *ast.Node, refFootnotes *[]*refAsFootnotes, tree
return ast.WalkContinue
}
if ast.NodeBlockRef == n.Type {
defID := n.ChildByType(ast.NodeBlockRefID).TokensStr()
if treenode.IsBlockRef(n) {
defID, _, _ := treenode.GetBlockRef(n)
if nil == getRefAsFootnotes(defID, refFootnotes) {
anchorText := sql.GetRefText(defID)
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(anchorText) {
@ -1463,12 +1457,11 @@ func exportRefTrees0(tree *parse.Tree, retTrees *map[string]*parse.Tree) {
return ast.WalkContinue
}
if ast.NodeBlockRef == n.Type {
defIDNode := n.ChildByType(ast.NodeBlockRefID)
if nil == defIDNode {
return ast.WalkSkipChildren
if treenode.IsBlockRef(n) {
defID, _, _ := treenode.GetBlockRef(n)
if "" == defID {
return ast.WalkContinue
}
defID := defIDNode.TokensStr()
defBlock := treenode.GetBlockTree(defID)
if nil == defBlock {
return ast.WalkSkipChildren

View file

@ -637,7 +637,7 @@ func GetDoc(startID, endID, id string, index int, keyword string, mode int, size
}
}
if ast.NodeBlockRef == n.Type {
if treenode.IsBlockRef(n) {
appendRefTextRenderResultForBlockRef(n)
return ast.WalkSkipChildren
}

View file

@ -178,7 +178,7 @@ func GetDocHistoryContent(historyPath, keyword string) (id, rootID, content stri
n.RemoveIALAttr("heading-fold")
n.RemoveIALAttr("fold")
if ast.NodeBlockRef == n.Type {
if treenode.IsBlockRef(n) {
appendRefTextRenderResultForBlockRef(n)
return ast.WalkSkipChildren
}
@ -266,7 +266,7 @@ func RollbackDocHistory(boxID, historyPath string) (err error) {
}
writingDataLock.Unlock()
RefreshFileTree()
FullReindex()
IncSync()
return nil
}
@ -321,7 +321,7 @@ func RollbackNotebookHistory(historyPath string) (err error) {
return
}
RefreshFileTree()
FullReindex()
IncSync()
return nil
}

View file

@ -124,12 +124,17 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
if !entering {
return ast.WalkContinue
}
if ast.NodeBlockRefID == n.Type {
newDefID := blockIDs[n.TokensStr()]
if treenode.IsBlockRef(n) {
defID, _, _ := treenode.GetBlockRef(n)
newDefID := blockIDs[defID]
if "" != newDefID {
n.Tokens = []byte(newDefID)
} else {
logging.LogWarnf("not found def [" + n.TokensStr() + "]")
if ast.NodeBlockRef == n.Type {
if id := n.ChildByType(ast.NodeBlockRefID); nil != id {
id.Tokens = []byte(newDefID)
}
} else {
n.TextMarkBlockRefID = newDefID
}
}
} else if ast.NodeBlockQueryEmbedScript == n.Type {
for oldID, newID := range blockIDs {
@ -291,7 +296,7 @@ func ImportSY(zipPath, boxID, toPath string) (err error) {
}
IncSync()
RefreshFileTree()
FullReindex()
return
}
@ -338,7 +343,7 @@ func ImportData(zipPath string) (err error) {
}
IncSync()
RefreshFileTree()
FullReindex()
return
}
@ -513,7 +518,7 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
}
IncSync()
RefreshFileTree()
FullReindex()
} else { // 导入单个文件
fileName := filepath.Base(localPath)
if !strings.HasSuffix(fileName, ".md") && !strings.HasSuffix(fileName, ".markdown") {

View file

@ -183,7 +183,7 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
unfold := true
for liFirstBlockSpan := li.FirstChild.FirstChild; nil != liFirstBlockSpan; liFirstBlockSpan = liFirstBlockSpan.Next {
if ast.NodeBlockRef == liFirstBlockSpan.Type {
if treenode.IsBlockRef(liFirstBlockSpan) {
continue
}
if "" != strings.TrimSpace(liFirstBlockSpan.Text()) {
@ -278,7 +278,7 @@ func toSubTree(blocks []*Block, keyword string) (ret []*Path) {
unfold := true
for headingFirstSpan := h.FirstChild; nil != headingFirstSpan; headingFirstSpan = headingFirstSpan.Next {
if ast.NodeBlockRef == headingFirstSpan.Type {
if treenode.IsBlockRef(headingFirstSpan) {
continue
}
if "" != strings.TrimSpace(headingFirstSpan.Text()) {

View file

@ -240,7 +240,7 @@ func CheckoutRepo(id string) (err error) {
return
}
RefreshFileTree()
FullReindex()
if syncEnabled {
func() {
time.Sleep(5 * time.Second)
@ -616,7 +616,7 @@ func syncRepo(boot, exit, byHand bool) (err error) {
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764
RefreshFileTree()
FullReindex()
return
}
incReindex(upserts, removes)

View file

@ -237,23 +237,18 @@ func renderTemplate(p, id string) (string, error) {
}
func appendRefTextRenderResultForBlockRef(blockRef *ast.Node) {
if ast.NodeBlockRef != blockRef.Type {
if !treenode.IsBlockRef(blockRef) {
return
}
refText := blockRef.ChildByType(ast.NodeBlockRefText)
if nil != refText {
return
}
refText = blockRef.ChildByType(ast.NodeBlockRefDynamicText)
if nil != refText {
refID, text, _ := treenode.GetBlockRef(blockRef)
if "" != text {
return
}
// 动态解析渲染 ((id)) 的锚文本
// 现行版本已经不存在该语法情况,这里保留是为了迁移历史数据
refID := blockRef.ChildByType(ast.NodeBlockRefID)
text := sql.GetRefText(refID.TokensStr())
text = sql.GetRefText(refID)
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(text) {
text = gulu.Str.SubStr(text, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
}

View file

@ -883,7 +883,9 @@ func (tx *Transaction) doUpdate(operation *Operation) (ret *TxErr) {
// 剔除空白的行级公式
unlinks = append(unlinks, n)
}
} else if ast.NodeBlockRefID == n.Type {
} else if ast.NodeBlockRef == n.Type {
sql.CacheRef(subTree, n)
} else if ast.NodeTextMark == n.Type && n.IsTextMarkType("block-ref") {
sql.CacheRef(subTree, n)
}
return ast.WalkContinue
@ -1098,27 +1100,28 @@ func updateRefText(refNode *ast.Node, changedDefNodes map[string]*ast.Node) (cha
if !entering {
return ast.WalkContinue
}
if ast.NodeBlockRef == n.Type && nil != n.ChildByType(ast.NodeBlockRefDynamicText) {
defIDNode := n.ChildByType(ast.NodeBlockRefID)
if nil == defIDNode {
return ast.WalkSkipChildren
}
defID := defIDNode.TokensStr()
defNode := changedDefNodes[defID]
if nil == defNode {
return ast.WalkSkipChildren
}
if ast.NodeDocument != defNode.Type && defNode.IsContainerBlock() {
defNode = treenode.FirstLeafBlock(defNode)
}
defContent := renderBlockText(defNode)
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(defContent) {
defContent = gulu.Str.SubStr(defContent, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
}
treenode.SetDynamicBlockRefText(n, defContent)
changed = true
if !treenode.IsBlockRef(n) {
return ast.WalkContinue
}
defID, _, subtype := treenode.GetBlockRef(n)
if "s" == subtype || "" == defID {
return ast.WalkContinue
}
defNode := changedDefNodes[defID]
if nil == defNode {
return ast.WalkSkipChildren
}
if ast.NodeDocument != defNode.Type && defNode.IsContainerBlock() {
defNode = treenode.FirstLeafBlock(defNode)
}
defContent := renderBlockText(defNode)
if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(defContent) {
defContent = gulu.Str.SubStr(defContent, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..."
}
treenode.SetDynamicBlockRefText(n, defContent)
changed = true
return ast.WalkContinue
})
return

View file

@ -52,10 +52,14 @@ func resetTree(tree *parse.Tree, titleSuffix string) {
// 收集所有引用
refIDs := map[string]string{}
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering || ast.NodeBlockRefID != n.Type {
if !entering || !treenode.IsBlockRef(n) {
return ast.WalkContinue
}
refIDs[n.TokensStr()] = "1"
defID, _, _ := treenode.GetBlockRef(n)
if "" == defID {
return ast.WalkContinue
}
refIDs[defID] = "1"
return ast.WalkContinue
})
@ -78,11 +82,19 @@ func resetTree(tree *parse.Tree, titleSuffix string) {
// 重置内部引用
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering || ast.NodeBlockRefID != n.Type {
if !entering || !treenode.IsBlockRef(n) {
return ast.WalkContinue
}
if "1" != refIDs[n.TokensStr()] {
n.Tokens = []byte(refIDs[n.TokensStr()])
defID, _, _ := treenode.GetBlockRef(n)
if "" == defID {
return ast.WalkContinue
}
if "1" != refIDs[defID] {
if ast.NodeBlockRefID == n.Type {
n.Tokens = []byte(refIDs[defID])
} else if ast.NodeTextMark == n.Type {
n.TextMarkBlockRefID = refIDs[defID]
}
}
return ast.WalkContinue
})

View file

@ -112,8 +112,8 @@ func GetRefsCacheByDefID(defID string) (ret []*Ref) {
var defIDRefsCache = gcache.New(30*time.Minute, 5*time.Minute) // [defBlockID]map[refBlockID]*Ref
func CacheRef(tree *parse.Tree, refIDNode *ast.Node) {
ref := buildRef(tree, refIDNode)
func CacheRef(tree *parse.Tree, refNode *ast.Node) {
ref := buildRef(tree, refNode)
putRefCache(ref)
}

View file

@ -269,7 +269,7 @@ func refsFromTree(tree *parse.Tree) (refs []*Ref, fileAnnotationRefs []*FileAnno
return ast.WalkContinue
}
if ast.NodeBlockRefID == n.Type {
if treenode.IsBlockRef(n) {
ref := buildRef(tree, n)
refs = append(refs, ref)
} else if ast.NodeFileAnnotationRefID == n.Type {
@ -306,9 +306,9 @@ func refsFromTree(tree *parse.Tree) (refs []*Ref, fileAnnotationRefs []*FileAnno
return
}
func buildRef(tree *parse.Tree, refIDNode *ast.Node) *Ref {
markdown := treenode.FormatNode(refIDNode.Parent, luteEngine)
defBlockID := refIDNode.TokensStr()
func buildRef(tree *parse.Tree, refNode *ast.Node) *Ref {
markdown := treenode.FormatNode(refNode, luteEngine)
defBlockID, text, _ := treenode.GetBlockRef(refNode)
var defBlockParentID, defBlockRootID, defBlockPath string
defBlock := treenode.GetBlockTree(defBlockID)
if nil != defBlock {
@ -316,8 +316,7 @@ func buildRef(tree *parse.Tree, refIDNode *ast.Node) *Ref {
defBlockRootID = defBlock.RootID
defBlockPath = defBlock.Path
}
text := treenode.GetDynamicBlockRefText(refIDNode.Parent)
parentBlock := treenode.ParentBlock(refIDNode)
parentBlock := treenode.ParentBlock(refNode)
return &Ref{
ID: ast.NewNodeID(),
DefBlockID: defBlockID,
@ -330,7 +329,7 @@ func buildRef(tree *parse.Tree, refIDNode *ast.Node) *Ref {
Path: tree.Path,
Content: text,
Markdown: markdown,
Type: treenode.TypeAbbr(refIDNode.Type.String()),
Type: treenode.TypeAbbr(refNode.Type.String()),
}
}

View file

@ -31,6 +31,50 @@ import (
"github.com/siyuan-note/logging"
)
func GetBlockRef(n *ast.Node) (blockRefID, blockRefText, blockRefSubtype string) {
if !IsBlockRef(n) {
return
}
if ast.NodeBlockRef == n.Type {
id := n.ChildByType(ast.NodeBlockRefID)
if nil == id {
return
}
blockRefID = id.TokensStr()
text := n.ChildByType(ast.NodeBlockRefText)
if nil != text {
blockRefText = text.Text()
blockRefSubtype = "s"
return
}
text = n.ChildByType(ast.NodeBlockRefDynamicText)
if nil != text {
blockRefText = text.Text()
blockRefSubtype = "d"
return
}
}
if ast.NodeTextMark == n.Type {
blockRefID = n.TextMarkBlockRefID
blockRefText = n.TextMarkTextContent
blockRefSubtype = n.TextMarkBlockRefSubtype
}
return
}
func IsBlockRef(n *ast.Node) bool {
if nil == n {
return false
}
if ast.NodeBlockRef == n.Type {
return true
}
if ast.NodeTextMark == n.Type {
return n.IsTextMarkType("block-ref")
}
return false
}
// NestedInlines2FlattedSpans 将嵌套的行级节点转换为平铺的文本标记节点。
func NestedInlines2FlattedSpans(tree *parse.Tree) {
defer logging.Recover()
@ -391,25 +435,31 @@ func GetLegacyDynamicBlockRefDefIDs(node *ast.Node) (ret []string) {
}
func SetDynamicBlockRefText(blockRef *ast.Node, refText string) {
if nil == blockRef {
if !IsBlockRef(blockRef) {
return
}
idNode := blockRef.ChildByType(ast.NodeBlockRefID)
if nil == idNode {
if ast.NodeBlockRef == blockRef.Type {
idNode := blockRef.ChildByType(ast.NodeBlockRefID)
if nil == idNode {
return
}
var spacesRefTexts []*ast.Node // 可能会有多个空格,或者遗留错误插入的锚文本节点,这里做一次订正
for n := idNode.Next; ast.NodeCloseParen != n.Type; n = n.Next {
spacesRefTexts = append(spacesRefTexts, n)
}
for _, toRemove := range spacesRefTexts {
toRemove.Unlink()
}
refText = strings.TrimSpace(refText)
idNode.InsertAfter(&ast.Node{Type: ast.NodeBlockRefDynamicText, Tokens: []byte(refText)})
idNode.InsertAfter(&ast.Node{Type: ast.NodeBlockRefSpace})
return
}
var spacesRefTexts []*ast.Node // 可能会有多个空格,或者遗留错误插入的锚文本节点,这里做一次订正
for n := idNode.Next; ast.NodeCloseParen != n.Type; n = n.Next {
spacesRefTexts = append(spacesRefTexts, n)
}
for _, toRemove := range spacesRefTexts {
toRemove.Unlink()
}
refText = strings.TrimSpace(refText)
idNode.InsertAfter(&ast.Node{Type: ast.NodeBlockRefDynamicText, Tokens: []byte(refText)})
idNode.InsertAfter(&ast.Node{Type: ast.NodeBlockRefSpace})
blockRef.TextMarkBlockRefSubtype = "d"
blockRef.TextMarkTextContent = refText
}
func GetDynamicBlockRefText(blockRef *ast.Node) string {