Skip to content

Rich Text Editor - - [ ] in plain text editor incorrectly expanded to * [ ] in rich text editor

Problem

- [ ] in plain text editor incorrectly expanded to * [ ] in rich text editor

Steps to reproduce

  1. Create a task item in plain text editor with - [ ] foo .
  2. Switch to RTE and add characters; e.g. - [ ] foos .
  3. Switch back to plain text and observe - is now *.

Solution

Ensure that - [ ] in plain text editor incorrectly expanded correctly in rich text editor

Implementation Guide

To notice the difference in implementation, we must observe bullet lists first. If you try to replicate this behaviour with regular bullet lists - list item vs * list item, you will notice that the bullet style is correctly preserved. In markdown lists (including bullet lists and task lists), there are three ways in which bullets can be defined: *, - and +. Now, we expect that similar behaviour is also preserved for task lists.

  1. Notice that bullet_list.js has an attribute called bullet which comes from Markdown sourcemaps. We need to add a similar attribute to task_list.js as well.
  2. In markdown_serializer.js, where all the prosemirror content is serialized to Markdown, you will notice that the serializer for TaskList already delegates to BulletList, so we do not need to make any changes here.
  3. We need to add tests covering sourcemaps for task lists. They are already covered for bullet lists in markdown_sourcemap_spec.js. We need to add one more case for task lists too.
Edited by Himanshu Kapoor