-
Notifications
You must be signed in to change notification settings - Fork 648
[Fix] Non-standard formatted tasklist items are not identified as tasklist items #3972
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
Changes from 2 commits
66dd4ea
2e20461
ad9c47f
8d676b5
10c0f45
5d8cc89
1aad0c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ const calculateNextListItemStarter = ({leadingWhitespace = '', delimeter, taskBo | |
| * 3. Task box (optional) | ||
| * 4. Everything following | ||
| */ | ||
| export const listItemRegex = /^(\s*)([*-]|(\d+)\.)\s(?:(\[[\sx]\])\s)?(.*)/i | ||
| export const listItemRegex = /^(\s*)([*-]|(\d+)\.)(\s{1,2})(?:(\[[\sx]\])\s)?(.*)/i | ||
|
|
||
| export type ListItem = { | ||
| leadingWhitespace: string | ||
|
|
@@ -45,7 +45,7 @@ const isNumericListItem = (item: ListItem | null): item is NumericListItem => ty | |
| export const parseListItem = (line: string): ListItem | null => { | ||
| const result = listItemRegex.exec(line) | ||
| if (!result) return null | ||
| const [, leadingWhitespace = '', fullDelimeter, itemNumberStr = '', taskBox = null, text] = result | ||
| const [, leadingWhitespace = '', fullDelimeter, itemNumberStr = '', , taskBox = null, text] = result | ||
|
||
| const itemNumber = Number.parseInt(itemNumberStr, 10) | ||
| const delimeter = Number.isNaN(itemNumber) ? (fullDelimeter as '*' | '-') : itemNumber | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are tab characters valid here? Maybe more correct would be space only (
). Not sure though. It's a minor thing though since that bug would've already been present before this change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\sis identifying tabs as well, i just checked