question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: "Bidirectional" Pushing of Block Reference

See original GitHub issue

I was very happy to see you linking this plugin in Discord, as I have been tinkering with Templater to achieve something similar. I am not sure what would be the proper name for it, but what I was trying to accomplish some sort of “bidirectional linking command” – to push an embedded block reference to a target note, but also leave a link to the target note at the end of the block of the current note. (probably easier to show via code than to explain it, so I attached the relevant part of the templater script.)

Linking this way is actually quite useful, as it allows to replicate the so called “coding” of qualitative analysis software like atlas.ti or MAXQDA. This would get Obsidian a big step closer to the idea of being used as qualitative analysis software, as described by @ryanjamurphy in this blog post.

As your plugin is already very close to what my Templater Script is trying to achieve, could you maybe add this sort of “bidirectional” linking to this plugin’s features? It wouldn’t be just a “nice-to-have” feature, but rather a feature for which there already is a very real use case.

<%*
// set delimiter Icon for meta-information at the end of a block
const delimiter = "♦︎";

// the search scope is restricted to notes beginning with the string set here.
const filterString = "°";

// select target note
var targetNote = await tp.system.suggester((item) => item.path, this.app.vault.getMarkdownFiles().filter(file => file.name.startsWith(filterString)), true);

// select & get current Block
let cmEditorAct = this.app.workspace.activeLeaf.view.editor;
const curLine = cmEditorAct.getCursor().line;
cmEditorAct.setSelection({ line: curLine, ch: 0 }, { line: curLine, ch: 9999 });
let blockText = tp.file.selection();

//Create link to target note
let targetNoteLink = "[[" + targetNote.name.replace (/\.md$/,"") + "]]";

//function to create block-ID
function createBlockHash() {
   let result = '';
   var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
   var charactersLength = characters.length;
   for ( var i = 0; i < 8; i++ ) {
       result += characters.charAt(Math.floor(Math.random() * charactersLength));
   }
   return result;
}

// Check whether block already has already been referenced
// append accordingly to source note
let blockIDExists = (blockText.match(/\^\w*$/) != null)
if (blockIDExists == true){
   var id = blockText.match(/\^\w*$/)[0];
   tR = blockText.split(delimiter)[0] + delimiter + blockText.split(delimiter)[1] + targetNoteLink + " " + delimiter + " " + id + "\n";
} else {
   var id = "^" + createBlockHash();
   tR = blockText + " " + delimiter + " " + targetNoteLink + " " + delimiter + " " + `${id}`;
}

// write to target note
let blockRef = `![[${tp.file.title}#${id}]]`;
const curContent = await this.app.vault.read(targetNote);
let newContents = curContent + "**" + tp.file.title + "** " + blockRef + "\n\n";
await this.app.vault.modify(targetNote, newContents);
%>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TfTHackercommented, Sep 10, 2021

So this is fascinating. Could you do a loom walking through how it would look?

But if i follow, it is similar to “push a block ref” to another file, but also block ref the destination in the current file?

Sorry if I didn’t get it right.

1reaction
TfTHackercommented, Sep 13, 2021

As we discussed, thank you for this idea. but it is to specific for the broader target audience.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push rules - GitLab Docs
In GitLab, you can use a predefined list of files to block those files from a repository. Merge requests that contain a file...
Read more >
Achieve bidirectional control and protection through back-to ...
This report highlights the challenges and limitations of existing implementations and discusses how eFuse devices can be used to improve power path protection ......
Read more >
Block reference - Feature archive - Obsidian Forum
The reason I like block referencing is because I don't want to deal with titles for every little thought. I want to do...
Read more >
Introduction to HTTP/2 - web.dev
Server push #. Another powerful new feature of HTTP/2 is the ability of the server to send multiple responses for a single client...
Read more >
Pushing All Syncable Assets to PSA - Kaseya HelpDesk
This feature is intended to push all the eligible Organizations, Configurations, Locations, and Contacts you have stored in IT Glue into your newly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found