Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all un-ordered list markers #72

Closed
vorpalvorpal opened this issue Jun 29, 2023 · 3 comments
Closed

Support all un-ordered list markers #72

vorpalvorpal opened this issue Jun 29, 2023 · 3 comments

Comments

@vorpalvorpal
Copy link

According to the markdown spec the following are all allowable syntax for unordered lists: *,-,+

At present, obsidian-task-marker only seems to recognise -

If I create the following list:

* item with an asterisk
- item with a dash
+ item with a plus

and then run the task-marker plugin on it I get:

* item with an asterisk
- [ ] item with a dash
+ item with a plus
@vorpalvorpal
Copy link
Author

I fixed this by changing lines 60-65 in main.js, which I believe correspond to lines 20-25 is taskmarker-TaskMarker.ts:

original:

    this.anyListItem = new RegExp(/^([\s>]*- )([^\\[].*)$/);
    this.anyTaskMark = new RegExp(/^([\s>]*- \[)(.)(\] .*)$/);
    this.blockQuote = new RegExp(/^(\s*>[\s>]*)(.*)$/);
    this.blockRef = new RegExp(/^(.*?)( \^[A-Za-z0-9-]+)?$/);
    this.continuation = new RegExp(/^( {2,}|\t)/);
    this.stripTask = new RegExp(/^([\s>]*-) \[.\] (.*)$/);

changed:

    this.anyListItem = new RegExp(/^([\s>]*[-+*] )([^\\[].*)$/);
    this.anyTaskMark = new RegExp(/^([\s>]*[-+*] \[)(.)(\] .*)$/);
    this.blockQuote = new RegExp(/^(\s*>[\s>]*)(.*)$/);
    this.blockRef = new RegExp(/^(.*?)( \^[A-Za-z0-9-]+)?$/);
    this.continuation = new RegExp(/^( {2,}|\t)/);
    this.stripTask = new RegExp(/^([\s>]*[-+*]) \[.\] (.*)$/);

That is changing the - in the regexs for anyListItem, anyTaskMark and stripTask to [-+*]

@wenlzhang
Copy link
Owner

@vorpalvorpal Thank you for the request and code!

I also updated some other parts of the code (2c55c7b) and released a new version.

Can you test if it works for you?

@wenlzhang wenlzhang added the status waiting Further information is requested label Jul 24, 2023
@wenlzhang
Copy link
Owner

Closing this for now. Please comment here if the new version does not satisfy your needs.

@wenlzhang wenlzhang added status done and removed status waiting Further information is requested labels Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants