Partial match for link mentions

Things I have tried

I have notes that are lessons which have the following filename format:

MXXLXX - Lesson name. Each XX is a number. Each lesson begins with the module and lesson number. Examples below.
M01L01 - Lesson Name
M01L02 - Lesson Name 2

What I’m trying to do

I’m trying to apply a template which contains the links to notes/mentions of the previous/next lesson without having to manually doing this.

The notes for each lesson don’t always exist however there are mentions in an MOC note which contains them all. However when I

I have been able to setup a regular expression to extract the lesson number from the filename and then determine the previous and the next lesson. However because the mention contains the lesson name it makes linking back to the previous lesson more difficult.

I have installed Obsidian Query Language and managed to find the text in the note however what I can’t seem to do is pull out the text from the match. How do you do this using Obsidian Query Language or is there a different plugin that I should be using?


<%*

//const query = "testing";
const query = '/(M01L01 - (.*)/';

// Perform the search 
app.internalPlugins.plugins['global-search'].instance.openGlobalSearch(query);

const searchLeaf = app.workspace.getLeavesOfType('search')[0];
const search = await searchLeaf.open(searchLeaf.view);
const rawSearchResult = await   new   Promise(resolve =>   setTimeout(() => { 
resolve(search.dom.resultDomLookup);
}, 300)); // the delay here was specified in 'obsidian-text-expand' plugin; I assume they had a reason   
   
const files = Array.from(rawSearchResult.keys());

console.log(files.map(x => x.path));

%>

<%
files.map(x => x.path)
%>

The Breadcrumbs plugin might do what you want, or might still require more work than you want.

https://breadcrumbs-wiki.onrender.com/docs/Getting%20Started/Relationships

(I can’t help with DataView.)

@CawlinTeffid thanks for the suggestion. I’ll check it out. I think a different question is needed.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.