feat/support-tasks-in-lists #1

Closed
VxMxPx wants to merge 1 commit from main into main
VxMxPx commented 2022-03-18 21:38:26 +01:00 (Migrated from github.com)

Support for auto inserting tasks in bullet lists (GH style).

Support for auto inserting tasks in bullet lists (GH style).
marijnh commented 2022-03-21 14:18:15 +01:00 (Migrated from github.com)

Would it be possible to integrate this in the regexp that's matched below your change, and add some conditional logic based on whether the task group in the regexp matched, to make it less verbose?

Would it be possible to integrate this in the regexp that's matched below your change, and add some conditional logic based on whether the task group in the regexp matched, to make it less verbose?
VxMxPx commented 2022-03-21 22:16:50 +01:00 (Migrated from github.com)

Yes I can do that.

Yes I can do that.
masad-frost commented 2022-04-07 03:53:58 +02:00 (Migrated from github.com)

Oh what a coincidence, I just finished implementing this in our fork (which handles this issue for us). I did exactly what Marijn is suggesting.

Here's the regex i landed on ^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)

capturing groups:

  1. indentation
  2. bullet style
  3. list marker (including leading spaces) optional
  4. trailing spaces

Changed passed the type from match[2] to match[2] + (match[3] || '')

Oh what a coincidence, I just finished implementing this in our fork (which handles [this issue](https://github.com/codemirror/codemirror.next/issues/793) for us). I did exactly what Marijn is suggesting. Here's the regex i landed on `^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)` capturing groups: 1. indentation 2. bullet style 3. list marker (including leading spaces) *optional* 4. trailing spaces Changed passed the `type` from `match[2]` to `match[2] + (match[3] || '')`
masad-frost (Migrated from github.com) reviewed 2022-04-07 03:55:05 +02:00
@ -52,1 +53,3 @@
let after = match[4], len = match[0].length
(match = /^([ \t]*)([-+*][ \t]+\[[ xX]\])([ \t]+)/.exec(nodeStart(node, doc)))) {
let after = match[3], len = match[0].length
if (after.length > 8) { after = after.slice(0, after.length - 8); len -= 8 }
masad-frost (Migrated from github.com) commented 2022-04-07 03:55:05 +02:00

Why is this 8?

Why is this 8?
marijnh commented 2022-04-07 08:13:36 +02:00 (Migrated from github.com)

Great. Want to submit your code as a new PR so I can merge it in?

Great. Want to submit your code as a new PR so I can merge it in?
masad-frost commented 2022-04-07 08:39:57 +02:00 (Migrated from github.com)

Can do, will push it up tomorrow or after at most

Can do, will push it up tomorrow or after at most

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/lang-markdown!1
No description provided.