bug in lists #51

Closed
opened 2021-01-01 04:36:53 +01:00 by williamstein · 6 comments
williamstein commented 2021-01-01 04:36:53 +01:00 (Migrated from github.com)

In the demo, clear the plain textbox and type:

* item
* another item

Then switch to WYSIWYM, then switch back, and you'll see

* item

* another item

This means something completely different in markdown -- it's a list with lots of space between each entry.

As far as I can tell, there isn't a way to even make a bulleted list without lots of space between entries using the WYSIWYM mode.


View the difference via Github's Markdown Renderer:

  • item
  • another item

VERSUS

  • item

  • another item

In [the demo](https://prosemirror.net/examples/markdown/), clear the plain textbox and type: ``` * item * another item ``` Then switch to WYSIWYM, then switch back, and you'll see ``` * item * another item ``` This means something completely different in markdown -- it's a list with lots of space between each entry. As far as I can tell, there isn't a way to even make a bulleted list without lots of space between entries using the WYSIWYM mode. --- View the difference via Github's Markdown Renderer: * item * another item VERSUS * item * another item
williamstein commented 2021-01-01 04:38:54 +01:00 (Migrated from github.com)

The same issue occurs with enumerated lists.

The same issue occurs with enumerated lists.
marijnh commented 2021-01-01 16:11:02 +01:00 (Migrated from github.com)

It seems that the markdown parser isn't setting the tight attribute (which stores the difference between the two types of Markdown lists), which is likely the source of this problem. I haven't checked how the current version of markdown-it exposes that, but I guess it shouldn't be too hard to fix that. Want to try creating a patch?

It seems that the markdown parser isn't setting the `tight` attribute (which stores the difference between the two types of Markdown lists), which is likely the source of this problem. I haven't checked how the current version of markdown-it exposes that, but I guess it shouldn't be too hard to fix that. Want to try creating a patch?
williamstein commented 2021-01-03 00:10:04 +01:00 (Migrated from github.com)

I haven't checked how the current version of markdown-it exposes that, [...]

I figured out how it does; markdown-it has a "hidden" attribute that the Prosemirror parser is ignoring. See https://markdown-it.github.io/markdown-it/#Token.prototype.hidden for the docs about it. In particular,

"If it's true, ignore this element when rendering. Used for tight lists to hide paragraphs."

Probably they used this approach as a sort of annoying hack to make their codebase easier to maintain...

Want to try creating a patch?

Unsure.

> I haven't checked how the current version of markdown-it exposes that, [...] I figured out how it does; markdown-it has a "hidden" attribute that the Prosemirror parser is ignoring. See https://markdown-it.github.io/markdown-it/#Token.prototype.hidden for the docs about it. In particular, > "If it's true, ignore this element when rendering. Used for tight lists to hide paragraphs." Probably they used this approach as a sort of annoying hack to make their codebase easier to maintain... > Want to try creating a patch? Unsure.
marijnh commented 2021-01-06 18:07:55 +01:00 (Migrated from github.com)

Attached patch seems to fix this.

Attached patch seems to fix this.
stephane-klein commented 2023-08-02 13:23:39 +02:00 (Migrated from github.com)

Attached patch seems to fix this.

@marijnh where is this patch? 🤔.

> Attached patch seems to fix this. @marijnh where is this patch? :thinking:.
marijnh commented 2023-08-02 17:43:47 +02:00 (Migrated from github.com)

Probably in the link right above my comment.

github.com/ProseMirror/prosemirror-markdown@64f7027973

Probably in the link right above my comment. https://github.com/ProseMirror/prosemirror-markdown/commit/64f70279732344c4b5deef821c108fff3484bd66
Sign in to join this conversation.
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
prosemirror/prosemirror-markdown#51
No description provided.