-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop creating paragraphs in tight lists #349
Conversation
Could you update the tests as well? |
@@ -28,6 +28,8 @@ function paragraph(eat, value, silent) { | |||
var character; | |||
var size; | |||
var now; | |||
var children; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn’t this make more sense in list-items?
I’m proposing some changes to mdast, as can be seen here.
Does that make sense? |
I think that makes tons of sense! Can you explain a bit more what you mean by |
@Hamms This value: - a
- b
c
- d Should in HTML be represented by Now, if we have an ambiguous tree that could be either: - a
- b
- d ...we can check the |
Hmmm, interesting. Just to make sure I'm following you, you mean the MDAST
That has been artificially modified by a utility that added the I'm actually not completely convinced that this should be converted into a HAST with |
Yes, I do mean that.
What I’m proposing is that:
We need to infer the actual looseness anyway in markdown. Not so sure about HTML, but that’s what I’m basing my thinking off, if that’s not true, we can skip it for HTML! When mapping to HTML, this behaviour would happen at list-level, wherever the property exists. |
👍 I would strongly advocate for dropping
The counterpoint I have to this is the original case when prompted me to dive into this: - item one
- item two In this case, |
@Hamms OK, few new ideas:
|
Okay, cool. So it sounds like we just need to make sure that paragraphs in tight lists are correctly dropped in |
Unless you object, I'm going to close this PR and focus my efforts on syntax-tree/mdast-util-to-hast#23 |
Yes, good! Quite the confusing problem! |
* remark-parse: remove `loose` fields from `list`, `listItem` * remark-parse: add support for empty list-items in any non-pedantic mode * remark-parse: add `spread` to `list`, to signal that its items should have blank lines between them, set to true if any blank line exists between items * remark-parse: add `spread` to `listItem`, to signal that its children should have blank lines between them * remark-parse: fix bug where two lists, if they are both ordered or both not ordered, was seen in commonmark as one list * remark-stringify: add support for missing `ordered` field * remark-stringify: add support for missing `start` field * remark-stringify: add support for `list.spread` (default: false) * remark-stringify: add support for `listItem.spread` (default: true) * remark-stringify: fix bug where two lists, if they are both ordered or both not ordered, and in commonmark, were not properly stringified, resulting in a new parse seeing them as one list * remark-stringify: fix bug where a list followed by an indented code block, in commonmark, was not correctly stringified, resulting in a new parse seeing the code as content of the list * remark-stringify: remove trailing white-space on empty list-items * remark-stringify: add support for stringifying list-items without parent Related to syntax-tree/mdast#4. Related to syntax-tree/mdast-util-to-hast#23. Related to GH-349. Closes GH-332. Closes GH-350. Closes GH-358. Closes GH-364. Reviewed-by: Elijah Hamovitz <elijahhamovitz@gmail.com> Reviewed-by: Ika <ikatyang@gmail.com>
Related to syntax-tree/mdast#4. Related to remarkjs/remark#349. Related to remarkjs/remark#350. Related to remarkjs/remark#364. Closes GH-23. Co-authored-by: Titus Wormer <tituswormer@gmail.com>
See syntax-tree/mdast-util-to-hast#23 for context.
This PR represents an opposing solution to the one presented in that PR; a solution in which the problematic paragraphs are never created in the first place, rather than being created and then discarded by the MDAST-to-HAST conversion.