mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 02:05:21 -04:00
Fix task list checkboxes for numbered lists (#1233)
* Fix replacer regex This regex handles the replacement of the [ ] with [x] and reverse. Until now it was build to check for an unordered list beginning with "*" or "-". This change permits "+" as well as digits followed by a dot (ordered lists). Signed-off-by: Erik Michelson <github@erik.michelson.eu> * Add cypress tests for task lists Signed-off-by: Erik Michelson <github@erik.michelson.eu> * Add bracket syntax for numbered lists Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
eac288cebc
commit
726b084509
2 changed files with 88 additions and 1 deletions
|
@ -87,7 +87,7 @@ export const NoteDetailsReducer: Reducer<NoteDetails, NoteDetailsAction> = (stat
|
|||
}
|
||||
}
|
||||
|
||||
const TASK_REGEX = /(\s*[-*] )(\[[ xX]])( .*)/
|
||||
const TASK_REGEX = /(\s*(?:[-*+]|\d+[.)]) )(\[[ xX]])( .*)/
|
||||
const setCheckboxInMarkdownContent = (markdownContent: string, lineInMarkdown: number, checked: boolean): string => {
|
||||
const lines = markdownContent.split('\n')
|
||||
const results = TASK_REGEX.exec(lines[lineInMarkdown])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue