Inline Todo Plugin

Thanks, I now see your response to my PR on your github page. Yeah, I'm sure most users do not use RTE. I almost exclusively use the RTE, only MD for tweaks. RTE existence is another reason why I prefer Joplin over Obsidian. Your TODO plugin is the other reason. It's better, IMO, than the Obsidian Tasks community plugin.

4 Likes

I almost exclusively use RTE, but tag Inline Todo notes as "layout:viewer" for the Persistent Editor Layout pluggin. Works well

Potentially useful for those who have to frequently push due date back a day or more. I created a Autohotkey hotkey script that does this.

The basic functionality is you have the cursor on the line containing the due date you want to increment by x days, then press the hotkey corresponding to # of days you want to push due date back (I have it set up for 1, 2, and 7 days, using key combo Win+1, Win+2, and Win+3, respectively, since I have dedicated buttons for these on my keyboard, but you can assign whatever hotkey (single key or keystroke combo) you wish). I can rapidfire press the hotkey to increment by multiples of the # of days corresponding to each hotkey.

On the row the cursor is on, the script is looking for the pattern //yyyy-mm-dd (*1) and will increment by # of days according to hotkey pressed, and overwrite the entire line with the same line except with the incremented date.

*1 - I use hotstrings to spit out much of the inline todo format, e.g., if I type ":-@d", it will expand to "- @desk //". I also use hotstrings for the date. If anyone has questions on this, ask away.

#1::IncrementDate(1) ; in Joplin 'Today' note, increments date by 1
#2::IncrementDate(2) ; in Joplin 'Today' note, increments date by 2
#3::IncrementDate(7) ; in Joplin 'Today' note, increments date by 7

IncrementDate(numDays) {
    if WinActive("ahk_exe Joplin.exe") {
        ; Get the current line
        A_Clipboard := ""  ; Clear the clipboard
        Send("{Home}+{End}^c")  ; Select the entire line and copy
        ClipWait(2)
        if !A_Clipboard {
            MsgBox("Failed to copy the current line.")
            ; MsgBox("IncrementDate() fxn is running")
            return
        }
        
        currentLine := A_Clipboard

        ; Regular expression to find the date pattern
        datePattern := "//(\d{4}-\d{2}-\d{2})"
        
        ; Check if the date pattern exists in the line
        if (RegExMatch(currentLine, datePattern, &dateMatch) > 0) {
            oldDate := dateMatch[1]
            
            ; Parse and increment the date
            newDate := IncrementDateBy(oldDate, numDays)
            
            ; Replace the old date with the new date
            newLine := StrReplace(currentLine, "//" . oldDate, "//" . newDate)
            
            ; Replace the current line with the new line
            A_Clipboard := newLine
            Send("{Home}+{End}^v")  ; Select the entire line and paste
            
            ToolTip("Date incremented: " . oldDate . " -> " . newDate)
            SetTimer () => ToolTip(), -2000  ; Remove the tooltip after 2 seconds
        } else {
            ToolTip("No date found in the current line.")
            SetTimer () => ToolTip(), -2000  ; Remove the tooltip after 2 seconds
        }

        Send("{Home}")
    }
}

IncrementDateBy(dateStr, numDays) {
    dateParts := StrSplit(dateStr, "-")
    year := Integer(dateParts[1])
    month := Integer(dateParts[2])
    day := Integer(dateParts[3])
    
    ; Create a date-time string in YYYYMMDDHH24MISS format
    dateTimeStr := Format("{:04}{:02}{:02}000000", year, month, day)
    
    ; Increment the date by one day
    newDateTime := DateAdd(dateTimeStr, numDays, "days")
    
    ; Format the new date back to YYYY-MM-DD
    return FormatTime(newDateTime, "yyyy-MM-dd")
}
1 Like

Following up on this Plugin, bcs I use it a lot.

This executable helps me get my todo's weekly in an excel:

Place the executable on your machine.
Go to your summary note, and select all, copy
Run the executable.
Open excel and paste.