mdelobelle / metadatamenu

For data management enthusiasts : type and manage the metadata of your notes.
https://mdelobelle.github.io/metadatamenu
MIT License
521 stars 27 forks source link

Canvas links are written as `- ![[LinkedCanvas.canvas]]` and rendered as `[[["LinkedCanvas"]]]` in Props view #388

Open ansley257 opened 1 year ago

ansley257 commented 1 year ago

Hi there,

Canvas links are writing incorrectly to the md files and rendering incorrectly in a different way in the new Properties view. I have a global file class defined (pasted below), which has an 'updates with links in canvas' field, called 'MoCs'. The canvas I'm using is my main MoC canvas, with other sub-MoC canvases inside of it. I have two rules in place for a link to show up, the edge must inbound, and the source node must be blue (the preconfigured light blue). I haven't seen any other issues about this, so my best guess is it may have something to do with the new release, which had a lot of changes to properties.

Expected Behavior

When you connect a blue canvas note outbound to another canvas note, the blue canvas note should appear in the properties of the inbound side canvas note, with the correct format:

MoCs: 
    - "[[πŸ¦„ Accounts MoC.canvass]]"
    - "[[🌼 Opportunities MoC.canvas]]" 

Actual Behavior

When you connect a blue canvas note outbound to another canvas note, the blue canvas appears in the properties of the inbound side canvas note, but is not formatted correctly. This is the format the way things are in the .md file itself:

MoCs:
    - ![[πŸ¦„ Accounts MoC.canvas]]
    - ![[🌼 Opportunities MoC.canvas]]

but when the properties view renders this it comes out as"

[[["πŸ¦„ Accounts MoC.canvas"], ["🌼 Opportunities MoC.canvas"]]]

Things I've tried:

Specs:

Obsidian v1.4.4 (installer 1.3.7) macOS Ventura v13.4 metadatamenu v0.5.1 (current)

Files

global fileClass

---
limit: 100
mapWithTag: false
icon: globe
tagNames: 
excludes: 
extends: 
version: 1
---

Title:: {"type":"Input","options":{}}
Created:: {"type":"Date","options":{"dateFormat":"YYYY-MM-DD","defaultInsertAsLink":"false"}}
Updated:: {"type":"Date","options":{"dateFormat":"YYYY-MM-DD","defaultInsertAsLink":"false"}}
Resource Type:: {"type":"Select","options":{"valuesList":{},"sourceType":"ValuesListNotePath","valuesListNotePath":"βš™οΈ Config/βš–οΈ Metadata Menu Class Options/Resource Type.md"}}
MoCs:: {"type":"Canvas","options":{"direction":"incoming","nodeColors":["5"],"edgeColors":[],"edgeFromSides":[],"edgeToSides":[],"edgeLabels":[],"canvasPath":"🌎 MoCs/🌎 MoC.canvas"}}

metadata menu configs saved to data.json

{
  "presetFields": [],
  "fileClassQueries": [],
  "displayFieldsInContextMenu": false,
  "globallyIgnoredFields": [],
  "classFilesPath": "πŸ—‚οΈ File Classes/",
  "isAutosuggestEnabled": true,
  "fileClassAlias": "class",
  "settingsVersion": 3,
  "globalFileClass": "global",
  "firstDayOfWeek": 1,
  "enableLinks": false,
  "enableTabHeader": true,
  "enableEditor": false,
  "enableBacklinks": false,
  "enableStarred": true,
  "enableFileExplorer": true,
  "enableSearch": false,
  "buttonIcon": "clipboard-list",
  "tableViewMaxRecords": 100,
  "frontmatterListDisplay": "asList"
}

core-plugins:

"file-explorer", "global-search", "switcher", "graph", "backlink", "canvas", "outgoing-link", "tag-pane", "properties", "page-preview", "note-composer", "command-palette", "slash-command", "editor-status", "bookmarks", "markdown-importer", "outline", "word-count", "file-recovery", "sync"

Other plugins:

actions-uri
heatmap-calendar obsidian-memos cmdr metadata-menu
quickadd colored-tags obsidian-columns templater-obsidian dataview
obsidian-git dbfolder
obsidian-linter

agrayseal commented 11 months ago

Not sure if I was having the same problem, but wanted to fix using canvas to link. That line of code did seem to be the one, I changed this in the compiled plugin code

case "Canvas" /* Canvas */:
          return renderMultiFields(rawValue, (item) => item ? `"${item}"` : "");

This fixes it for me