siyuan-note / insider

SiYuan Insider Preview
https://b3log.org/siyuan
67 stars 2 forks source link

块引用循环依赖问题 #430

Closed 2234839 closed 3 years ago

2234839 commented 3 years ago

块引用bug

88250 commented 3 years ago

重置一下外观还有快捷键以后再试试。

2234839 commented 3 years ago

重置一下外观还有快捷键以后再试试。

不行

88250 commented 3 years ago

老铁麻烦发一下 .sy

2234839 commented 3 years ago

老铁麻烦发一下 .sy

你将一个块转标题然后再转文档,我就是这样触发的

2234839 commented 3 years ago

a2.sy

{
    "ID": "20210521213414-dhvrn0v",
    "Type": "NodeDocument",
    "Properties": {
        "id": "20210521213414-dhvrn0v",
        "type": "doc",
        "updated": "20210521213441"
    },
    "Children": [
        {
            "ID": "20210521213415-odphtad",
            "Type": "NodeParagraph",
            "Properties": {
                "id": "20210521213415-odphtad",
                "updated": "20210521213425"
            },
            "Children": [
                {
                    "Type": "NodeBlockRef",
                    "Data": "span",
                    "Children": [
                        {
                            "Type": "NodeOpenParen"
                        },
                        {
                            "Type": "NodeOpenParen"
                        },
                        {
                            "Type": "NodeBlockRefID",
                            "Data": "20210521213412-5qmcwh1"
                        },
                        {
                            "Type": "NodeCloseParen"
                        },
                        {
                            "Type": "NodeCloseParen"
                        }
                    ]
                },
                {
                    "Type": "NodeText",
                    "Data": " "
                },
                {
                    "Type": "NodeBlockRef",
                    "Data": "span",
                    "Children": [
                        {
                            "Type": "NodeOpenParen"
                        },
                        {
                            "Type": "NodeOpenParen"
                        },
                        {
                            "Type": "NodeBlockRefID",
                            "Data": "20210521213414-dhvrn0v"
                        },
                        {
                            "Type": "NodeCloseParen"
                        },
                        {
                            "Type": "NodeCloseParen"
                        }
                    ]
                }
            ]
        },
        {
            "ID": "20210521213427-jbp28hm",
            "Type": "NodeParagraph",
            "Properties": {
                "id": "20210521213427-jbp28hm",
                "updated": "20210521213437"
            },
            "Children": [
                {
                    "Type": "NodeText",
                    "Data": "test "
                },
                {
                    "Type": "NodeBlockRef",
                    "Data": "span",
                    "Children": [
                        {
                            "Type": "NodeOpenParen"
                        },
                        {
                            "Type": "NodeOpenParen"
                        },
                        {
                            "Type": "NodeBlockRefID",
                            "Data": "20210521213415-odphtad"
                        },
                        {
                            "Type": "NodeCloseParen"
                        },
                        {
                            "Type": "NodeCloseParen"
                        }
                    ]
                }
            ]
        },
        {
            "ID": "20210521213438-7bh7z5o",
            "Type": "NodeParagraph",
            "Properties": {
                "id": "20210521213438-7bh7z5o",
                "updated": "20210521213438"
            }
        },
        {
            "ID": "20210521213433-dpvvgo4",
            "Type": "NodeParagraph",
            "Properties": {
                "id": "20210521213433-dpvvgo4",
                "updated": "20210521213433"
            }
        }
    ]
}

a1.sy

{
    "ID": "20210521213412-tcddvom",
    "Type": "NodeDocument",
    "Properties": {
        "id": "20210521213412-tcddvom",
        "updated": "20210521213441"
    },
    "Children": [
        {
            "ID": "20210521213412-5qmcwh1",
            "Type": "NodeParagraph",
            "Properties": {
                "id": "20210521213412-5qmcwh1",
                "updated": "20210521213413"
            },
            "Children": [
                {
                    "Type": "NodeText",
                    "Data": "a1"
                }
            ]
        }
    ]
}
88250 commented 3 years ago

这里有个解析上的循环依赖没有解决,即 a 中的块引指向了 a 自己,这个得稍微推后点再处理了,谢谢。

88250 commented 3 years ago

a9 中通过设置最大循环深度 7 来控制,发布以后请帮忙回测,谢谢。

2234839 commented 3 years ago
  1. 将一个块转标题然后再转文档,此时该文档内显示不正确。
  2. 然后再将该文档拖动原来的文档内转标题 ,此时仍然显示不正确。 但直接构建 第二步那样的结构是可以正确显示的

另外还发现一个问题,这里链中链只是引用上一个块,但渲染的结果比较奇怪 QQ截图20210522231819

正常渲染应该是这样 image

.sy 数据 { "ID": "20201104155455-awawq0n", "Type": "NodeDocument", "Properties": { "id": "20201104155455-awawq0n", "type": "doc", "updated": "20210522231316" }, "Children": [ { "ID": "20201105103725-dd01qas", "Type": "NodeHeading", "HeadingLevel": 1, "Properties": { "id": "20201105103725-dd01qas" }, "Children": [ { "Type": "NodeHeadingC8hMarker", "Data": "# " }, { "Type": "NodeText", "Data": "思源笔记" } ] }, { "ID": "20201125120429-wccr64p", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-wccr64p" }, "Children": [ { "Type": "NodeLink", "Children": [ { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "思源代码库" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "https://github.com/siyuan-note/siyuan" }, { "Type": "NodeCloseParen", "Data": ")" } ] } ] }, { "ID": "20210209130024-fggewdd", "Type": "NodeParagraph", "Properties": { "id": "20210209130024-fggewdd", "updated": "20210209130024" }, "Children": [ { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20201121142422-1gk6qv5" }, { "Type": "NodeBlockRefSpace" }, { "Type": "NodeBlockRefText", "Data": "OceanPress : 思源生成静态站点" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210209160954-nbkk1df", "Type": "NodeParagraph", "Properties": { "id": "20210209160954-nbkk1df" }, "Children": [ { "Type": "NodeBlockRef", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210209161008-nzq3um7" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210408140212-hmw7apb", "Type": "NodeThematicBreak", "Properties": { "id": "20210408140212-hmw7apb" } }, { "ID": "20201125120429-kph1c2j", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-kph1c2j" }, "Children": [ { "Type": "NodeLink", "Children": [ { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "关于思源笔记的 markdown 如何渲染" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "https://github.com/siyuan-note/siyuan/issues/418" }, { "Type": "NodeCloseParen", "Data": ")" } ] } ] }, { "ID": "20201125120429-p8ls74r", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": { "id": "20201125120429-p8ls74r" }, "Children": [ { "Type": "NodeHeadingC8hMarker", "Data": "## " }, { "Type": "NodeText", "Data": "如何自定义渲染器" } ] }, { "ID": "20201125120429-08b8ykm", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-08b8ykm" }, "Children": [ { "Type": "NodeLink", "Children": [ { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "JavaScript 重写渲染器的方法" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "https://github.com/88250/lute/issues/5" }, { "Type": "NodeCloseParen", "Data": ")" } ] }, { "Type": "NodeText", "Data": " " }, { "Type": "NodeLink", "Children": [ { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "原版渲染器地址" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "https://github.com/88250/lute/blob/master/render/html_renderer.go" }, { "Type": "NodeCloseParen", "Data": ")" } ] }, { "Type": "NodeText", "Data": " " }, { "Type": "NodeLink", "Children": [ { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "Markdown 解析原理详解和 Markdown AST 描述" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "https://ld246.com/article/1587637426085" }, { "Type": "NodeCloseParen", "Data": ")" } ] } ] }, { "ID": "20201125120429-5mfeymc", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-5mfeymc" }, "Children": [ { "Type": "NodeText", "Data": "在 parser/parser.go 中有描述一些渲染配置" } ] }, { "ID": "20201125120429-bylt3e6", "Type": "NodeCodeBlock", "IsFencedCodeBlock": true, "CodeBlockFenceChar": 96, "CodeBlockFenceLen": 3, "CodeBlockOpenFence": "YGBg", "CodeBlockInfo": "amF2YXNjcmlwdA==", "CodeBlockCloseFence": "YGBg", "Properties": { "id": "20201125120429-bylt3e6" }, "Children": [ { "Type": "NodeCodeBlockFenceOpenMarker", "Data": "```", "CodeBlockFenceLen": 3 }, { "Type": "NodeCodeBlockFenceInfoMarker", "CodeBlockInfo": "amF2YXNjcmlwdA==" }, { "Type": "NodeCodeBlockCode", "Data": "lute.SetKramdownIAL(true); // 不将块id {: id=\"20201105110148-yqza4sm\"} 渲染为文本\nlute.SetKramdownIALIDRenderName(\"data-block-id\"); // 将块 id 赋值给元素的data-block-id\n" }, { "Type": "NodeCodeBlockFenceCloseMarker", "Data": "```", "CodeBlockFenceLen": 3 } ] }, { "ID": "20210209124629-yract2b", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": { "id": "20210209124629-yract2b" }, "Children": [ { "Type": "NodeHeadingC8hMarker", "Data": "## " }, { "Type": "NodeText", "Data": "记录思源仓库 999 start ( 2021/2/9)" } ] }, { "ID": "20210209124658-zwds59g", "Type": "NodeParagraph", "Properties": { "id": "20210209124658-zwds59g" }, "Children": [ { "Type": "NodeImage", "Children": [ { "Type": "NodeBang", "Data": "!" }, { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "image.png" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "assets/20210209124659-14r2h9q-image.png" }, { "Type": "NodeCloseParen", "Data": ")" } ] } ] }, { "ID": "20201125120429-rq6gnau", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": { "id": "20201125120429-rq6gnau" }, "Children": [ { "Type": "NodeHeadingC8hMarker", "Data": "## " }, { "Type": "NodeText", "Data": "以下是用来测试渲染效果的" } ] }, { "ID": "20201125120429-gph7gp3", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-gph7gp3" }, "Children": [ { "Type": "NodeText", "Data": "页面引用: " }, { "Type": "NodeBlockRef", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20201105161628-4vktwyt" }, { "Type": "NodeBlockRefSpace" }, { "Type": "NodeBlockRefText", "Data": "思源笔记 其他记录" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20201125120429-1jptmeq", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-1jptmeq" }, "Children": [ { "Type": "NodeText", "Data": "块引用:" }, { "Type": "NodeBlockRef", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20201105161704-racjvte" }, { "Type": "NodeBlockRefSpace" }, { "Type": "NodeBlockRefText", "Data": "我提的一些 issues 思源笔记" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210408144740-vj8pk0b", "Type": "NodeParagraph", "Properties": { "id": "20210408144740-vj8pk0b", "updated": "20210408144802" }, "Children": [ { "Type": "NodeText", "Data": "链中链: " }, { "Type": "NodeBlockRef", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20201125120429-1jptmeq" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20201125120429-0wng1w1", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-0wng1w1" }, "Children": [ { "Type": "NodeText", "Data": "下面是嵌入块引用" } ] }, { "ID": "20210521142715-8lgb2tu", "Type": "NodeBlockQueryEmbed", "Properties": { "id": "20210521142715-8lgb2tu" }, "Children": [ { "Type": "NodeOpenBrace" }, { "Type": "NodeOpenBrace" }, { "Type": "NodeBlockQueryEmbedScript", "Data": "SELECT * FROM blocks WHERE id = \u0026#39;20201105161704-racjvte\u0026#39;" }, { "Type": "NodeCloseBrace" }, { "Type": "NodeCloseBrace" } ] }, { "ID": "20201125120429-762p6xt", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-762p6xt" }, "Children": [ { "Type": "NodeText", "Data": "下面是一行嵌入块" } ] }, { "ID": "20210521142715-pvdg8c3", "Type": "NodeBlockQueryEmbed", "Properties": { "id": "20210521142715-pvdg8c3" }, "Children": [ { "Type": "NodeOpenBrace" }, { "Type": "NodeOpenBrace" }, { "Type": "NodeBlockQueryEmbedScript", "Data": "SELECT * FROM blocks WHERE id = \u0026#39;20201121142250-68i2qmv\u0026#39;" }, { "Type": "NodeCloseBrace" }, { "Type": "NodeCloseBrace" } ] }, { "ID": "20201125120429-16mryh8", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-16mryh8", "updated": "20210521144952" }, "Children": [ { "Type": "NodeText", "Data": "数学公式演示 " }, { "Type": "NodeInlineMath", "Data": "span", "Children": [ { "Type": "NodeInlineMathOpenMarker" }, { "Type": "NodeInlineMathContent", "Data": "a^3" }, { "Type": "NodeInlineMathCloseMarker" } ] } ] }, { "ID": "20201125120429-bs1n28w", "Type": "NodeMathBlock", "Properties": { "id": "20201125120429-bs1n28w" }, "Children": [ { "Type": "NodeMathBlockOpenMarker" }, { "Type": "NodeMathBlockContent", "Data": "a^3" }, { "Type": "NodeMathBlockCloseMarker" } ] }, { "ID": "20201125120429-8c3ecc0", "Type": "NodeCodeBlock", "IsFencedCodeBlock": true, "CodeBlockFenceChar": 96, "CodeBlockFenceLen": 3, "CodeBlockOpenFence": "YGBg", "CodeBlockInfo": "amF2YXNjcmlwdCB7cnVufQ==", "CodeBlockCloseFence": "YGBg", "Properties": { "id": "20201125120429-8c3ecc0" }, "Children": [ { "Type": "NodeCodeBlockFenceOpenMarker", "Data": "```", "CodeBlockFenceLen": 3 }, { "Type": "NodeCodeBlockFenceInfoMarker", "CodeBlockInfo": "amF2YXNjcmlwdCB7cnVufQ==" }, { "Type": "NodeCodeBlockCode", "Data": "console.log(3333)\n" }, { "Type": "NodeCodeBlockFenceCloseMarker", "Data": "```", "CodeBlockFenceLen": 3 } ] }, { "ID": "20201125120429-f3dync7", "Type": "NodeParagraph", "Properties": { "id": "20201125120429-f3dync7" }, "Children": [ { "Type": "NodeLink", "Children": [ { "Type": "NodeOpenBracket", "Data": "[" }, { "Type": "NodeLinkText", "Data": "相对路径测试" }, { "Type": "NodeCloseBracket", "Data": "]" }, { "Type": "NodeOpenParen", "Data": "(" }, { "Type": "NodeLinkDest", "Data": "../blog" }, { "Type": "NodeCloseParen", "Data": ")" } ] } ] }, { "ID": "20201125141217-41uqvwo", "Type": "NodeSuperBlock", "Properties": { "id": "20201125141217-41uqvwo", "updated": "20210521144852" }, "Children": [ { "Type": "NodeSuperBlockOpenMarker" }, { "Type": "NodeSuperBlockLayoutMarker" }, { "ID": "20201125140645-gn17aas", "Type": "NodeParagraph", "Properties": { "id": "20201125140645-gn17aas", "updated": "20210521144852" }, "Children": [ { "Type": "NodeStrikethrough", "Data": "s", "Children": [ { "Type": "NodeStrikethrough2OpenMarker" }, { "Type": "NodeText", "Data": "超级块测试" }, { "Type": "NodeStrikethrough2CloseMarker" } ] }, { "Type": "NodeText", "Data": " , " }, { "Type": "NodeStrong", "Data": "strong", "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "键盘样式" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeText", "Data": ": " }, { "Type": "NodeKbd", "Data": "kbd", "Children": [ { "Type": "NodeKbdOpenMarker" }, { "Type": "NodeText", "Data": "ctrl+space" }, { "Type": "NodeKbdCloseMarker" } ] }, { "Type": "NodeText", "Data": " " }, { "Type": "NodeUnderline", "Data": "u", "Children": [ { "Type": "NodeUnderlineOpenMarker" }, { "Type": "NodeText", "Data": "上下标演示" }, { "Type": "NodeUnderlineCloseMarker" } ] }, { "Type": "NodeText", "Data": ": X" }, { "Type": "NodeSup", "Data": "sup", "Children": [ { "Type": "NodeSupOpenMarker" }, { "Type": "NodeText", "Data": "2" }, { "Type": "NodeSupCloseMarker" } ] }, { "Type": "NodeText", "Data": " H" }, { "Type": "NodeSub", "Data": "sub", "Children": [ { "Type": "NodeSubOpenMarker" }, { "Type": "NodeText", "Data": "2" }, { "Type": "NodeSubCloseMarker" } ] }, { "Type": "NodeText", "Data": "O " } ] }, { "ID": "20210209125951-hlpghto", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": { "id": "20210209125951-hlpghto", "updated": "20210209125951" }, "Children": [ { "Type": "NodeText", "Data": "test" } ] } ] }, { "ID": "20210521142715-ewlpy1y", "Type": "NodeBlockQueryEmbed", "Properties": { "id": "20210521142715-ewlpy1y" }, "Children": [ { "Type": "NodeOpenBrace" }, { "Type": "NodeOpenBrace" }, { "Type": "NodeBlockQueryEmbedScript", "Data": "SELECT * FROM blocks WHERE id = \u0026#39;20201125141217-41uqvwo\u0026#39;" }, { "Type": "NodeCloseBrace" }, { "Type": "NodeCloseBrace" } ] }, { "ID": "20210105213133-6v6wnn4", "Type": "NodeParagraph", "Properties": { "id": "20210105213133-6v6wnn4", "updated": "20210408155724" }, "Children": [ { "Type": "NodeStrong", "Properties": { "style": "background-image: linear-gradient(to right, var(--b3-theme-primary), var(--b3-theme-error)); -webkit-background-clip: text; color: transparent;" }, "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "高亮功能测试" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeKramdownSpanIAL", "Data": "{: style=\"background-image: linear-gradient(to right, var(--b3-theme-primary), var(--b3-theme-error)); -webkit-background-clip: text; color: transparent;\"}" }, { "Type": "NodeText", "Data": "," }, { "Type": "NodeStrong", "Properties": { "style": "background-color: rgb(41, 253, 46); color: var(--b3-theme-background);" }, "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "背景高亮" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeKramdownSpanIAL", "Data": "{: style=\"background-color: rgb(41, 253, 46); color: var(--b3-theme-background);\"}" }, { "Type": "NodeText", "Data": "," }, { "Type": "NodeStrong", "Properties": { "style": "color: rgb(255, 253, 56);" }, "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "字" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeKramdownSpanIAL", "Data": "{: style=\"color: rgb(255, 253, 56);\"}" }, { "Type": "NodeStrong", "Properties": { "style": "color: rgb(255, 253, 56);" }, "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "体高亮" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeKramdownSpanIAL", "Data": "{: style=\"color: rgb(255, 253, 56);\"}" }, { "Type": "NodeText", "Data": "," }, { "Type": "NodeStrong", "Properties": { "style": "color: rgb(30, 177, 237);" }, "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "亮亮" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeKramdownSpanIAL", "Data": "{: style=\"color: rgb(30, 177, 237);\"}" }, { "Type": "NodeText", "Data": " " }, { "Type": "NodeStrong", "Properties": { "style": "background-color: rgb(255, 253, 56); color: rgb(252, 13, 27);" }, "Children": [ { "Type": "NodeStrongA6kOpenMarker", "Data": "**" }, { "Type": "NodeText", "Data": "亮亮亮亮亮" }, { "Type": "NodeStrongA6kCloseMarker", "Data": "**" } ] }, { "Type": "NodeKramdownSpanIAL", "Data": "{: style=\"background-color: rgb(255, 253, 56); color: rgb(252, 13, 27);\"}" }, { "Type": "NodeText", "Data": "亮" } ] }, { "ID": "20210105213956-skaq7b6", "Type": "NodeParagraph", "Properties": { "id": "20210105213956-skaq7b6", "updated": "20210408163433" }, "Children": [ { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210105213133-6v6wnn4" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210521144447-q3rwqa6", "Type": "NodeHeading", "HeadingLevel": 2, "Properties": { "id": "20210521144447-q3rwqa6", "updated": "20210521144504" }, "Children": [ { "Type": "NodeText", "Data": "横排以及样式演示" } ] }, { "ID": "20210521144359-y9ductv", "Type": "NodeSuperBlock", "Properties": { "id": "20210521144359-y9ductv", "updated": "20210521144325" }, "Children": [ { "Type": "NodeSuperBlockOpenMarker" }, { "Type": "NodeSuperBlockLayoutMarker", "Data": "col" }, { "ID": "20210521144407-4gkotn1", "Type": "NodeSuperBlock", "Properties": { "id": "20210521144407-4gkotn1", "updated": "20210521144325" }, "Children": [ { "Type": "NodeSuperBlockOpenMarker" }, { "Type": "NodeSuperBlockLayoutMarker", "Data": "row" }, { "ID": "20210521144419-x62weyc", "Type": "NodeSuperBlock", "Properties": { "id": "20210521144419-x62weyc", "updated": "20210521144325" }, "Children": [ { "Type": "NodeSuperBlockOpenMarker" }, { "Type": "NodeSuperBlockLayoutMarker", "Data": "col" }, { "ID": "20210521144312-8awidn0", "Type": "NodeParagraph", "Properties": { "id": "20210521144312-8awidn0", "style": "color: var(--b3-card-info-color);background-color: var(--b3-card-info-background);", "updated": "20210521144320" }, "Children": [ { "Type": "NodeText", "Data": "信息样式" } ] }, { "ID": "20210521144320-85tiijy", "Type": "NodeParagraph", "Properties": { "id": "20210521144320-85tiijy", "style": "color: var(--b3-card-success-color);background-color: var(--b3-card-success-background);", "updated": "20210521144325" }, "Children": [ { "Type": "NodeText", "Data": "成功样式" } ] }, { "ID": "20210521144432-093uud2", "Type": "NodeSuperBlock", "Properties": { "id": "20210521144432-093uud2", "updated": "20210521144432" }, "Children": [ { "Type": "NodeSuperBlockOpenMarker" }, { "Type": "NodeSuperBlockLayoutMarker", "Data": "row" }, { "ID": "20210521144332-7n3lcti", "Type": "NodeParagraph", "Properties": { "id": "20210521144332-7n3lcti", "style": "color: var(--b3-card-error-color);background-color: var(--b3-card-error-background);", "updated": "20210521144338" }, "Children": [ { "Type": "NodeText", "Data": "错误样式" } ] }, { "ID": "20210521144325-y66vcbc", "Type": "NodeParagraph", "Properties": { "id": "20210521144325-y66vcbc", "style": "color: var(--b3-card-warning-color);background-color: var(--b3-card-warning-background);", "updated": "20210521144332" }, "Children": [ { "Type": "NodeText", "Data": "警告样式" } ] }, { "Type": "NodeSuperBlockCloseMarker" } ] }, { "Type": "NodeSuperBlockCloseMarker" } ] }, { "Type": "NodeSuperBlockCloseMarker" } ] }, { "Type": "NodeSuperBlockCloseMarker" } ] }, { "ID": "20210521144338-li21s3u", "Type": "NodeParagraph", "Properties": { "id": "20210521144338-li21s3u", "updated": "20210521145233" }, "Children": [ { "Type": "NodeText", "Data": "a1" } ] }, { "ID": "20210521145234-acec78s", "Type": "NodeHeading", "HeadingLevel": 3, "Properties": { "id": "20210521145234-acec78s", "refcount": "1", "updated": "20210521145925" }, "Children": [ { "Type": "NodeText", "Data": "a2" } ] }, { "ID": "20210521145235-h87n5a5", "Type": "NodeParagraph", "Properties": { "id": "20210521145235-h87n5a5", "refcount": "1", "updated": "20210521145245" }, "Children": [ { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210521144338-li21s3u" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] }, { "Type": "NodeText", "Data": " " }, { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210521145234-acec78s" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210521145247-y8eovoc", "Type": "NodeParagraph", "Properties": { "id": "20210521145247-y8eovoc", "refcount": "1", "updated": "20210522103541" }, "Children": [ { "Type": "NodeText", "Data": "引用 :" }, { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210521145235-h87n5a5" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210521145558-v3khbwd", "Type": "NodeParagraph", "Properties": { "id": "20210521145558-v3khbwd", "updated": "20210521145558" } } ] }

2234839 commented 3 years ago

a9 中通过设置最大循环深度 7 来控制,发布以后请帮忙回测,谢谢。

我在写 oceanpress 的方法是对块的 id 进行检测,只有在一次对文档的渲染中 该id 被嵌套渲染两次才视为循环引用,目前来看效果似乎还不错

88250 commented 3 years ago
  1. 将一个块转标题然后再转文档,此时该文档内显示不正确。
  2. 然后再将该文档拖动原来的文档内转标题 ,此时仍然显示不正确。 但直接构建 第二步那样的结构是可以正确显示的

我这里现在似乎重现不了,等 a10 发布以后再看看,谢谢。

issue

2234839 commented 3 years ago

问题依然存在 循环引用bug_a10

test.sy { "ID": "20210526095820-umh45p9", "Type": "NodeDocument", "Properties": { "id": "20210526095820-umh45p9", "updated": "20210526095956" }, "Children": [ { "ID": "20210526095820-s3y9vxa", "Type": "NodeParagraph", "Properties": { "id": "20210526095820-s3y9vxa", "updated": "20210526095824" }, "Children": [ { "Type": "NodeText", "Data": "a1" } ] }, { "ID": "20210526095825-wfq6ahl", "Type": "NodeHeading", "HeadingLevel": 1, "Properties": { "id": "20210526095825-wfq6ahl", "updated": "20210526095950" }, "Children": [ { "Type": "NodeText", "Data": "a2" } ] }, { "ID": "20210526095827-8bbk0ca", "Type": "NodeParagraph", "Properties": { "id": "20210526095827-8bbk0ca", "updated": "20210526095848" }, "Children": [ { "Type": "NodeText", "Data": "引用 " }, { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210526095820-s3y9vxa" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] }, { "Type": "NodeText", "Data": " \u0026 " }, { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210526095825-wfq6ahl" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210526095851-t14xm2x", "Type": "NodeParagraph", "Properties": { "id": "20210526095851-t14xm2x", "updated": "20210526095908" }, "Children": [ { "Type": "NodeText", "Data": "引用上一段 " }, { "Type": "NodeBlockRef", "Data": "span", "Children": [ { "Type": "NodeOpenParen" }, { "Type": "NodeOpenParen" }, { "Type": "NodeBlockRefID", "Data": "20210526095827-8bbk0ca" }, { "Type": "NodeCloseParen" }, { "Type": "NodeCloseParen" } ] } ] }, { "ID": "20210526095909-g87f9vu", "Type": "NodeParagraph", "Properties": { "id": "20210526095909-g87f9vu", "updated": "20210526095909" } } ] }
88250 commented 3 years ago

这个问题有点复杂,我估计不能支持循环依赖。wolai 解决这个问题的方案很优秀,后面我们借鉴一下吧。

image

2234839 commented 3 years ago

这个问题有点复杂,我估计不能支持循环依赖。wolai 解决这个问题的方案很优秀,后面我们借鉴一下吧。

image

在这个场景下似乎还算不得循环依赖,因为块引用不会显示标题块下的内容,以同样的逻辑构建一个块嵌入的才是循环依赖吧

88250 commented 3 years ago

上面这个例子是循环依赖的,之前你举的例子也是的。只要解析路径上出现了循环,就没法解决了,设定深度显示会给用户带了困扰,最好的方式还是直接告诉用户这里有循环依赖,直接打断依赖。

2234839 commented 3 years ago

每一个块都在引用上面已经声明的块,我没有明白那里出现了循环

88250 commented 3 years ago

问题出在动态解析锚文本的时候,比如:

a ((id_b))

b ((id_a))
2234839 commented 3 years ago

问题出在动态解析锚文本的时候,比如:

a ((id_b))

b ((id_a))

这个确实是循环依赖,但在这个场景下并不构成循环依赖

id1:  a1

id2:  # a2

id3: 引用 ((id1)) & ((id2))

id4: 引用上一段 ((id3))
2234839 commented 3 years ago

image 思源第一次打开的时候也是可以正确显示的,但在将 a2 转为文档再转回来的时候触发了循环依赖的判断就很奇怪

88250 commented 3 years ago

转换文档那里,a2 会引用 a2 自己。

2234839 commented 3 years ago

转换文档那里,a2 会引用 a2 自己。

但块引用是不涉及内容的,只有块嵌入才会。 这里是可以正常解析锚文本的

88250 commented 3 years ago

块引的时候需要渲染锚文本,但锚文本不是渲染时候才解析,而是编辑更新操作时候解析好放到 refs 表里。

2234839 commented 3 years ago

块引的时候需要渲染锚文本,但锚文本不是渲染时候才解析,而是编辑更新操作时候解析好放到 refs 表里。

a2 在转文档的时候: 如果 refs 表内没有 a2 : 在转成功之后应该更新一次 如果 refs 表内 a2 还在的话,应该不会有任何问题。

我还是认为这是思源本身的一个问题,而非块之间处于循环引用


刚刚在 我来 尝试了一下,他也是没有将这种情况视作循环引用的

image

88250 commented 3 years ago

a11 里面稍微调整了一下,等发布以后再看看,谢谢。