foambubble / foam

A personal knowledge management and sharing system for VSCode
https://foambubble.github.io/
Other
15.37k stars 659 forks source link

Cyclic link detected for wikilink: test. Error while including ![[test]] into the current document of the Preview panel #1407

Open RobotMo opened 2 days ago

RobotMo commented 2 days ago

Describe the bug

When I embed another note in the note, the preview window gets the error message:“Cyclic link detected for wikilink: test”. However, the embedded file does not contain any wiki links, so deleting the embedded note will not eliminate this error. Foam output information:

[error - 9:10:14 AM] Error while including ![[rw]] into the current document of the Preview panel
"TypeError: Cannot read properties of null (reading 'toLocaleLowerCase')\n\tat Kn (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:228:4810)\n\tat yr.find (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:228:3554)\n\tat c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:280:406\n\tat Array.map (<anonymous>)\n\tat kS (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:280:370)\n\tat tj (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:284:6)\n\tat Object.replace (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:276:2648)\n\tat t.rendererRule (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:222:4856)\n\tat u.renderer.rules.<computed> [as embed-wikilinks] (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:222:5438)\n\tat s.renderInline (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:196045)\n\tat s.render (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:196449)\n\tat t.MarkdownItEngine.render (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:636560)\n\tat async t.MdDocumentRenderer.renderBody (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:644089)\n\tat async t.MdDocumentRenderer.renderDocument (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:643016)\n\tat async d._updatePreview (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:651262)"
[error - 10:19:25 AM] Error while including ![[test]] into the current document of the Preview panel
"TypeError: Cannot read properties of null (reading 'toLocaleLowerCase')\n\tat Kn (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:228:4810)\n\tat yr.find (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:228:3554)\n\tat c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:280:406\n\tat Array.map (<anonymous>)\n\tat kS (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:280:370)\n\tat tj (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:284:6)\n\tat Object.replace (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:276:2648)\n\tat t.rendererRule (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:222:4856)\n\tat u.renderer.rules.<computed> [as embed-wikilinks] (c:\\Users\\22688\\.vscode\\extensions\\foam.foam-vscode-0.26.1\\out\\bundles\\extension-node.js:222:5438)\n\tat s.renderInline (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:196045)\n\tat s.render (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:196449)\n\tat t.MarkdownItEngine.render (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:636560)\n\tat async t.MdDocumentRenderer.renderBody (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:644089)\n\tat async t.MdDocumentRenderer.renderDocument (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:643016)\n\tat async d._updatePreview (d:\\Programs\\Microsoft VS Code\\resources\\app\\extensions\\markdown-language-features\\dist\\extension.js:1:651262)"

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  1. Create a new note S (Don't add pictures);
  2. Embedding newly created note S into a master note file M;
  3. Add a picture to s, such as “读写锁互斥关系表
  4. At this time, the embedded quotation of S in the main note M will not be previewed normally, and the picture cannot be replied to the normal preview display after deleting the picture

Expected behavior

I hope this bug can be improved, or get a method that can eliminate this error and correctly display the content of the embedded notes。

Screenshots or Videos

Embedded content: image The result of an error occurred: image

Operating System Version

Windows10

Visual Studio Code Version

Version: 1.94.2 (user setup) Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427 Date: 2024-10-09T16:08:44.566Z Electron: 30.5.1 ElectronBuildId: 10262041 Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.19045

Additional context

No response

RobotMo commented 2 days ago

It is hoped that at least after I delete the picture in the content in the main note, the child's note can be embedded normally again. Otherwise, this error affects use very much. Once a file accidentally causes this error, it will directly cause this file to be unable to be cited again.

RobotMo commented 1 day ago

After several trials, it has been verified that using img tags to insert images instead of using md's image introduction method can avoid this problem