Coder Social home page Coder Social logo

thingnotok / obsidian-toggle-list Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 5.0 838 KB

This is a simple plugin for Obsidian to overwrite the default behavior of toggle checkbox status. Also, it offers a simple way to toggle through frequently used attributes: task states, task tags, highlighted list, etc.

License: MIT License

JavaScript 4.57% TypeScript 94.31% CSS 1.12%
obsidian todo

obsidian-toggle-list's Introduction

ToggleList Plugin for Obsidian

ToggleList is a plugin for Obsidian that provides an alternative way to toggle checkbox status and allows for easy toggling between frequently used attributes such as task states, task tags, highlighted lists, and more. This simple plugin overwrites the default toggle behavior in Obsidian, making it more customizable and user-friendly.

Plugin Features

ToggleList provides the following features:

  1. Hotkey toggling of list states within a state group:

    • For example, a state group might include the following states: ["", - , - [ ] , - [x]]
  2. Multiple state groups for different purpose

    • Task group: [- [ ] , - [/], - [x]]
    • Highlight group: [- [i] , - [!], - [?]]
  3. Prefix and Suffix Support. State Prefix||Suffix can match Prefix line contents Suffix.

    • Timestamp can be used in both Prefix and Suffix using {time:: time-format}, e.q. {time:: YYYY-MM-DD}. Supported time format can be found in Supported Time Format.
    • Use cases
      • Task created / completed: - [ ] || ➕[[{time:: YYYY-MM-DD}]] / - [ ] || ✅ {time:: YYYY-MM-DD} (Tasks' style)
      • Interstitial journaling: - **{time:: hh:mm}**
  4. Suggestion window: turn on suggestion for commands so the whole state group with show in suggestion window for quick access.

    Screen.Recording.2023-02-26.at.01.04.30.mov
  5. States visualization

    image

  6. Togglelist works as a handy tool to setup contents in other plugins, check Working with other Plugins for more examples

Here's why checkboxes need more states and how to query these customized states:

Project Use Case Query Customized Items

Installation

From repositary

  1. Download the folder and put in Vault/.obsidian/plugin.
  2. Enable it from Installed Plugins

From Community Plugins

  1. Search for ToggleList in Commnity Plugins/Browse
  2. Install and enable it from Installed Plugins

From BRAT

  1. Install [Obsidian 42 - BRAT] from Community Plugins
  2. Add this repository in Obsidian 42 - BRAT/ Add Beta Plugin
    • Paste this url: https://github.com/thingnotok/obsidian-toggle-list
  3. Enable this plugin from Installed Plugins

Changelog

[1.2.3]

  • Add blockID support
    • toggling states will not mess with blockID now
    • Cursor location rule
      • if cursor is in prefix, it will be moved to the head of the content
      • if cursor is in content, it will stay at the same location w.r.t the content
      • if cursor is in surfix, it will be moved to the end of the content
      • if cursor is in blockID, it will be moved to the end of the line

[1.2.1]

  • Time related update
    • Timestamps in states can now be customized with {time:: YYYY-MM-DD hh:mm:ss}
      • old settings {tasks-today} will be automatically converted to ✅ {time:: YYYY-MM-DD}
    • Fix date error for #23 (possibly)

[1.2.0]

  • merge suggesiton window action with regular action.
    • custom hotkey for pop command will be automatically assigned to Next action.
    • commands without iPopOver will not be affected.
    • If the upgrade break your setting, I'm really sorry, and please leave a issue so I can help you.

[1.1.3]

  • resolve the performance issue #14
  • update the suggestion window when hotkey is consectively triggered
  • update UI
  • refactor main, setting, tlActions

[1.0.6/7] - [[2023-02-26]]

  • Clarity
    • State Diagram in setting tab to provide a better understanding of state groups.
    • Empty line is now rendered as {PARAGRAPH}.
  • Suggestion Mode
    • Commands have suggestion mode now. A suggestion editor will pop when command/hotkey is triggered.
  • Codebase reorganization
    • the project is reorganized to clarity.
  • Many thanks to engage-results and replete for their valuable suggestions.

[1.0.5] - [[2022-11-08]]

  • Toggles
    • Add support for indentation using spaces.
  • Commands
    • Add contextual toggles support with same command
    • Allow user to modify command name
  • Settings
    • Add a config backup before Reset command

[1.0.3/4] - [[2022-10-31]]

  • Add suffix to support Tasks Plugin usage
  • Add an additional default group to show List Callouts Plugin usage
  • Add random state group selection to new group button
  • Add Reset button to recover to default state groups
  • Add Hotkey button to link to hotkey setup page
  • Update Description in setting tab page

[1.0.1] - [[2022-10-25]]

Added

  • Allow multiple state groups

obsidian-toggle-list's People

Contributors

thingnotok avatar attomos avatar prtksxna avatar

Stargazers

 avatar  avatar Ales Rybak avatar  avatar  avatar Horacio Mijail Antón Quiles avatar  avatar Juan Pedro Bretti Mandarano avatar  avatar Cal Desmond-Pearson avatar Roland Siegbert avatar AtlcatlQ avatar Thea avatar a13ph avatar  avatar Alex Caminha avatar Holland avatar  avatar Eric S. avatar Steve Burgett avatar  avatar  avatar  avatar Brian Anderson avatar  avatar Phil Ricketts avatar  avatar Pch avatar  avatar Zubayr Ali avatar Leyang avatar Andrezza Souza avatar Antti Boman avatar JuestChaOS avatar  avatar Boninall avatar Shamy Ji avatar  avatar Huy Z avatar  avatar

Watchers

 avatar  avatar

obsidian-toggle-list's Issues

[Feature Request] context-based state cycling

I am currently tying to bind two different cycles to the same command, one for callout bullets and one for custom task bullets.
i believe that you should have the option to cycle through any of the states you have with one command ie:

if you have two state cycles:
State 0

- [ ] ||
- [?] ||

State 1

||
- ||
- i

i should be able to do:

(ctrl+enter) (state1)
- || (ctrl+enter) (state1)
- i (ctrl+enter) (state1)
- [ ] i (typed)
- [?] i (ctrl+enter) (state0)

Feature request: second set of checkboxes

Hi! If it is possible, it would be great to have second set of checkboxes to use it with another hotkey (for example I use done/incomplete/forwarded for my to-do and question/important/idea for my study notes, it would be cool to run through them separately)

Thanks for the great plugin! (:

{tasks-today} shows tomorrow instead of today

Not too sure why, but instead of today, it shows tomorrow. Might be a timezone problem? Though I can't see why this plugin would use anything other than my local computer time. How can I go about troubleshooting this?

Supporting for Android

Hi! After last update plugin doesn't work on Android, neither with community plugins nor with BRAT installing

List Callouts CSS

Hello,
Does anyone recommend any source of List Callouts CSS snippet?
Great plugin!
Thanks!

Feature Request: more flexibility to define transitions

Background

Imagine we have a task with a created date, thanks to ToggleList:

- [ ] My task ➕ 2024-01-01

When we use ToggleList again to cycle the task status to "done", the existing date is removed and a new one is added:

- [x] My task  ✅ 2024-04-29

There is no way to define next states like these with a single hotkey:

- [/] My task ➕ 2024-01-01

(note the [/] checkbox)

- [x] My task  ➕ 2024-01-01 ✅ 2024-04-29

Even if we define multiple cycles and hotkeys, for example one to add the creation date ➕ and another to add the finished date ✅, cycling through any of them will remove the corresponding date and re-add today's date (instead of the original one). So going through a cycle causes the existing date to be lost.

Feature Request

It would be great to have a few changes to be able to accomplish these transitions with a single hotkey.

  • Allow each state group to be non-cyclical: once the end of the group is reached, that group doesn't evolve further and allows other groups to match.
    This would allow to have multiple groups assigned to a single hotkey, such that e.g. the creation date group gets stuck when a ➕ is in the line, and then the finished date group can take over to add the ✅.
  • Allow greater control over what is matched and what is changed in each transition.
    Currently, the format {time:: YYYY-MM-DD} is used both for matching (so that YYYY-MM-DD is any date) and for adding today's date in the given format. It would be much more flexible to e.g. use grep patterns with subgroups for replacement, where in the replacement we could also add the {time} variable. For example, to finish a task and add to it a finished date while respecting the existing creation date:
    match: - [ ] (.* ➕[\d-])
    replace: - [x] \1 ✅ {time:: YYYY-MM-DD}

cycling through bullet points yields weird results

state group:

- ||
- ? ||
- ! ||
- $ ||

expected:
- hi
- ? hi
- ! hi
- $ hi
- hi
result:
- hi
- ? hi
- ! hi
- $ hi
- ? $ hi

reason: pattern matching for prefix is taking the smallest match rather than the largest match for replacing.
ie:
- $ hi results in - ? $ hi because the smallest pattern of - || was matched and replaced first before - $ ||

[Idea] Interactive state diagram to setup state groups

Now that obsidian has canvas, the state diagram can be converted to/from a canvas page. In that way, I can avoid using text area to config states. the discussion and diagram in #12 can be a good start point.

  • convert current setting to a canvas page
  • verify if a canvas can be converted to setting
  • compile the errors as message to help debug
  • convert canvas to setting
  • how to express command and hotkey in canvas (color, text, ... )

Suggest use `~` instead of `-`

~ already means strikeout in Markdown. Better to reuse that association in [~]. And then I suggest to use wavy line-through instead of straight line-through which is already associated with the usual "done" state in many themes, including the default Obsidian theme.

It's also less likely to clash with other people's pre-existing use of [-]

1.0.5 not working on IOS

Hi,

Since the update from 1.0.4 to 1.0.5, you can't add ToggleList to the mobile bar.

Can you help?

[Feature Request] Tag select

Thanks for making this plugin, it is super handy for working with tasks and perfectly complements the other task plugins.

I was hoping to use this plugin to toggle 'status' hashtags on a list, but they are inserted in front of the text and that doesn't make much sense for tasks

Is this possible with current features? I tried {raw} but it wasn't parsed.

This plugin makes dealing with tasks so much easier through hotkeys, daily driving now.

As an aside, I am tempted to extend this plugin with a dropdown/popup tag selector - multi-selecting a range of tags via UI tied to a hotkey would be excellent. And maybe a sort order.

Great work, thanks again for contributing to the community.

Cheers

Bug: hotkeys for binded state group commands don't work after renaming the command.

Let's say I have a state group command binding with a certain name, assign a hotkey to the binding with that name. If I change then name, then the hotkey no longer works unless I change it back. I noticed in the hotkeys.json file, you give command names to Obsidian, whatever names I write down in the plugin settings.

What if in your code, you generated IDs for each state group binding, and used those in the command names internally, so that if a binding is renamed, the hotkey still works?

Allow for a description in suggestion window

It would be nice to be able to provide a description in the suggestion window.

Maybe with handlebars or something. For example,

- [ ]  {d:Blank}
- [x] {d:Completed}

Thanks for the great plugin.

[Feature Request] Nested Tasks

Would like the ability to toggle tasks that are subtasks or nested within lists.

Example:

- [ ] Task with a subtask
    - [ ]  Task that cannot be toggled via a state group
- List with a subtask
    - [ ]  Task that cannot be toggled via a state group

Error in the console

Everything seems to work ok, but I am getting this error in my console.

Error
image

State Groups
image

Support {task-created-today}

The tasks plugin uses: to signify when a task is completed. But I'm wondering if you can add an additional template for the tasks that are created today:

ex:

- [ ] test ➕ 2023-09-01

Let me know if you have any questions!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.