open all forward links

Posted by FlohGro, Last update 8 months ago

created by @FlohGro / more on my Blog

open all forward links

finds [[wiki-style-links]] in the current Draft. If one or more are found the action will open them differently depending on the platform you’re running it.
- On macOS it will open each forward link in a new tab.
- On iPadOS it will present a prompt and open the selected Draft in a new window
- On iOS it will present a prompt and load the selected Draft in the editor

If you find this useful and want to support me you can donate or buy me a coffe

Buy Me A Coffee


  • script

     * opens a selected forward link in wiki-style-format in the given draft (if existing)
     * @param {Draft} d the Draft in which you want to find wiki-style-links
    function openAllForwardLinksFromDraft(d) {
        let content = d.content;
        const regex = /\[\[([^\]]+)\]\]/g;
        const matches = [];
        let match;
        while ((match = regex.exec(content)) !== null) {
            const linkText = match[1];
            if(!matches.includes(linkText) && linkText != draft.displayTitle){
        if (matches.length > 0) {
            let draftsToOpen = []
            matches.forEach((match) => {
                draftsToOpen = draftsToOpen.concat(Draft.queryByTitle(match))
            let window = app.currentWindow
                draftsToOpen.forEach((curDraft) => {
            } else {
                // not a mac → user needs to select the draft to open
                let p = new Prompt()
                p.title = "select draft to open"
                p.message = "tabs are not supported on iPhone / iPad, please select the draft to open"
            draftsToOpen.forEach((curDraft) => {
                let selectedDraft = p.buttonPressed
                if(device.model == "iPad"){
                } else {
        }else {
            app.displayWarningMessage("no forward links found in draft")


  • After Success Nothing
    Notification Error
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.