text icon indicating copy to clipboard operation
text copied to clipboard

Incorrect Task List syntax

Open broslavski opened this issue 5 years ago • 2 comments

Describe the bug When creating a tasklist with checkboxes, the markdown code of the note is being created inconsistent with GitHub Markdown Guide and Extended Syntax of Markdown Guide.

To Reproduce Steps to reproduce the behavior:

  1. Create a new file
  2. Open the file using NextCloud text
  3. Create Task List and wait until file is saved
  4. Open the Markdown code of the note.
  5. Each item in the list is displayed as * [ ] but not as - [ ]

Also, a previously saved note with correct syntax is converted to invalid when it is re-saved.

Expected behavior Each item in the Task List must begin with - [ ].

Text app version: 3.1.0

broslavski avatar Dec 23 '20 20:12 broslavski

For uniformity we should probably just use the - dash for both lists and task lists exclusively, those are also the first recommendations of the basic guides for normal unordered lists.

jancborchardt avatar Feb 10 '21 14:02 jancborchardt

Using * [ ] is perfectly valid GDM markdown according to https://github.github.com/gfm/#task-list-item-marker but I agree that using - is probably a nicer plaintext default.

juliusknorr avatar Apr 08 '21 10:04 juliusknorr

This is directly rendered in Markdown by https://github.com/ProseMirror/prosemirror-markdown

https://github.com/ProseMirror/prosemirror-markdown/blob/af34ce60514afa8074fa32f82a08f622670a415d/src/to_markdown.ts#L83-L97

We must check how to change this default behavior in a good way.

vinicius73 avatar Oct 17 '22 20:10 vinicius73

We already have the option to change the default with the bullet parameter, and we also extend the rendering and have our custom toMarkdown methods:

src/nodes/TaskList.js
35:		state.renderList(node, '  ', () => (node.attrs.bullet || '*') + ' ')

juliusknorr avatar Oct 18 '22 17:10 juliusknorr

We already have the option to change the default with the bullet parameter, and we also extend the rendering and have our custom toMarkdown methods:

I've already tested it, but didn't work in my test, I can try more later.

vinicius73 avatar Oct 18 '22 17:10 vinicius73