Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Copy link

Thanks for making and sharing this templater. Unfortunately, this one doesn't work anymore.

Here is the console report:

I used to used a similar templater that I forget where I get it from (maybe from your Github?), below.

const search = app.workspace.getLeavesOfType("search")[0];
const editor = app.workspace.activeLeaf.view.editor;
const getCur = editor.getCursor();
const curLineNum = getCur.line;
const curPos =;
let thisFile = app.workspace.getActiveFile();
let mdCache =;
let mdLinks = mdCache.links;
if (mdLinks) {
    let otherLink;
    let foundLink = mdLinks.find(eachLink => {
        const startPos = eachLink.position.start;
        const endPos = eachLink.position.end;
        if(startPos.line === curLineNum) {
            otherLink = eachLink;
            if(startPos.col <= curPos && endPos.col >= curPos) {
                return true;
            } else {return false;}
        } else {return false;}
    if(!foundLink){foundLink = otherLink}
    if(foundLink) {
        //SortOrder Options: alphabeticalReverse, alphabetical, byModifiedTime, byModifiedTimeReverse, byCreatedTime, byCreatedTimeReverse
        let myString =;
        myString = myString.replace(/[-[\]{}()+?.,\\^$|#]/g, '\\$&');

I do need your help to fix this templater if you don't mind, since it is so helpful for me to find other files that contain a particular unresolved link. I made tons of unresolved links as opposed to tags. Also, I don't know about coding at all.

Many thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment