Zettelkasten Forum


[Plug-In] Tasks in Markdown

edited November 19 in Plug-In Showcase

I am delighted to see TheArchive opening up to plug-ins, and I took the chance to build a first example for my use case.

To identify unfinished thoughts, I add tasks (to-dos) to notes to catch up later. Markdown does not support task lists natively, but there is a quasi-standard that GitHub uses. It's written

- [ ] Task to be done at some point

Download the latest version: https://github.com/iltempo/thearchive-tasks-plugin/releases/latest

The repository and code can be found at https://github.com/iltempo/thearchive-tasks-plugin

Feedback is welcome as a comment or on GitHub.

Post edited by ctietze on

Comments

  • That's cool, and I believe it's actually on @Sascha's wishlist of scripts from a couple of years ago :)

    I left feedback on the GH repository. Sharing the .zip from GitHub is a good example, too 👍

    Author at Zettelkasten.de • https://christiantietze.de/

  • @iltempo, this clarifies the mayhem of lost to-dos in my ZK. This plugin surfaced a plethora of ignored to-dos. Thanks for the dope slap.

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • @Will, I am happy to hear that. Hopefully, it does not create a lot of additional work for you. :wink:

    There is another release v1.1.0, detecting additional task formats. Ordered lists and lists with stars (*). Feel free to update and test.
    https://github.com/iltempo/thearchive-tasks-plugin/releases/tag/1.1.0

  • @iltempo, thanks a ton. I just completed most of my tasks just by installing your update. :wink:

    Here is the original daunting list.

    This is what the update now reports.

    We would have expected more todos. Something must be about the regex. It did capture the todos without a - in front of the [ ].

    If there is anything I can test to help troubleshoot, let me know.

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • edited October 7

    @Will Thank you for sharing. I must have introduced an issue with the regular expression. I will look into it soon.

    You can go back to the previous version if you wish.

  • No, I like this version better. It makes me seem more productive. :wink:

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • This regex captures all the tasks.
    const tasksRegex = /\d*[-*.] .* \[ \]|\[ \] .*/g;

    But so does.
    const tasksRegex = /\[ \] .*/g;

    I wonder about the value of capturing the prepended notation. Do you have a use case for this?

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • I will give the regex a try. Thanks.

    Regarding your question about the prepended notation, check out our discussion on GH: https://github.com/iltempo/thearchive-tasks-plugin/issues/1

  • My initial idea was to detect square brackets in notes without list notation. This will work fine but also detect empty square brackets anywhere in the text that are not meant to be tasks. Task lists should be concise, but users may not be willing or able to change the notation of their existing notes.

    Users may process their notes with Markdown. This is why I would like to follow that standard.

    @Will, I am a bit puzzled as to why your tasks are not detected anymore.

    • Can you please recheck the version to be 1.1.0?
    • Can you run the following sample note with the plugin, please?

    Thank you!

    # Sample Note for Tasks Testing
    
    ## Tasks to not be detected
    
    [ ] Invalid task without list
        [ ] Invalid intended task without list
    Not even a task
    [x] Completed task
    This is [ ] not a task but brackets somewhere in the text
    
    ## Tasks to be detected
    
    - [ ] Task one
    * [ ] Task two
    1. [ ] Task three
    99. [ ] Task four
        - [ ] Task five
      - [ ] Task six
      * [ ] Task seven
      99. [ ] Task eighth
    
  • @iltempo, thanks for indulging me. This is a great use case. I now see the intention to collect only MarkDown-compliant tasks.

    The mystery is partly solved. Most of my tasks don't follow the GitHub-flavored Markdown format. But that doesn't explain the "Invalid intended task without list" or the "not a task but brackets somewhere in the text." Those tasks listed under "[[Formatting Guide 201903010000]]" are of the format tab,tab,tab[ ] Read. I'm surprised the regex captures them.

    Here are the results of running your test note with V1.1.0

    Tasks:
    
    [[Sample Note for Task Testing 202410080410]]
     [ ] Invalid intended task without list
     [ ] not a task but brackets somewhere in the text
    - [ ] Task one
    * [ ] Task two
    1. [ ] Task three
    99. [ ] Task four
    - [ ] Task five
    - [ ] Task six
    * [ ] Task seven
    99. [ ] Task eighth 
    
    [[Deep Think Retreat 202311021610]]
    - [ ] Deep Think Retreat
    - [ ] Think about how to put the proofing oven notes online
    - [ ] Reading sprint
    * [ ] Typing sprint
    98. [ ] Year-End Review Process
    
    [[Formatting Guide 201903010000]]
     [ ] Read
     [ ] Process into structure note
     [ ] Integrate into Zettelkasten
    

    Maybe I'm confused, unschooled, or just opinionated, but I use the Marked2 app as my gold standard for Markdown. Only a few of us programers even know that GitHub has its own version. Here is a screenshot. In order to format the output correctly, we'd want to add 2 blank spaces to the ends of each line a task was on.

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • @Will, regarding the rendering, the problem seems to be due to a missing newline.

    https://github.com/iltempo/thearchive-tasks-plugin/issues/5

    I am a user of Marked2, too. The GitHub Markdown should also work in Marked2.

  • ... and the issue about the wrongly detected tasks.

    https://github.com/iltempo/thearchive-tasks-plugin/issues/6

  • @Will, would you mind trying the new version, including the fixes for hopefully all problems?

    https://github.com/iltempo/thearchive-tasks-plugin/releases/tag/1.2.0

    Thanks!

  • Success!

    May your day be filled with smiles.

    Will Simpson
    My zettelkasten is for my ideas, not the ideas of others. I don’t want to waste my time tinkering with my ZK; I’d rather dive into the work itself. My peak cognition is behind me. One day soon, I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • Hurray. 🙌

    Thank you for your testing and the helpful feedback!

Sign In or Register to comment.