datacore icon indicating copy to clipboard operation
datacore copied to clipboard

Support for linked inline fields

Open dleeftink opened this issue 2 years ago • 2 comments

I am wondering if the parser will support linked inlines:

[[ target-file#heading | topic :: weather ]]

I am working on a plugin that automatically appends/updates backlinks (and their surrounding context) to a specified #heading in a target-file. Above example for instance, would add/update the line topic :: weather in target-file.md under Heading.

It would be nice if the link alt text could be parsed on the 'sending' note without having to include additional parentheses inside the link for correct parsing. This way, the inline field is synchronised (i.e. pushed) from the 'sending' note to the 'target' note [1].

BTW, this already works in the 'sending' note when using GFM: [topic :: weather](target-file.md#heading).

[1]: In the future, possibly even two-way synced.

dleeftink avatar May 15 '23 14:05 dleeftink

This does seem like an interesting format for inline fields. I can add support for parsing inline fields out of links.

blacksmithgu avatar Sep 15 '23 08:09 blacksmithgu

The way I've setup the plugin is that it would push whatever alt text is provided in a link, if the linked note satisfies some user conditions (e.g. the linked file exists in a selected folder, its file name matches a regex, its contents include certain properties or headings). The only thing missing currently, is a way for Dataview to parse the Wiki-style links in the sending note.

For instance,

  • [[ target | property :: value ]] -> sends nothing to the target note, but Dataview ideally parses the alt text.

  • [[ target# | property :: value ]] -> inserts or updates the target note metadata property with value with the alt link text parsed by Dataview in the sending note. Notice how a # without heading suffix is recognised by the plugin as a linked inline field to be pushed to a target note's metadata section, with minimal link keystrokes required on the user end.

  • [[ target#heading | property :: value ]] -> inserts or updates the first target note inline property with value under Heading, with the alt link text parsed by Dataview in the sending note.

Additionally, the inline nesting level in the sending note is reflected in the target.md file as well, which allows for some interesting use-cases.

dleeftink avatar Sep 15 '23 08:09 dleeftink