Skip to content
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

Marked adds extra/unnecessary <p> tags to list elements #1298

Closed
utdrmac opened this issue Jun 27, 2018 · 5 comments · Fixed by #1304
Closed

Marked adds extra/unnecessary <p> tags to list elements #1298

utdrmac opened this issue Jun 27, 2018 · 5 comments · Fixed by #1304
Labels
category: lists L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@utdrmac
Copy link

utdrmac commented Jun 27, 2018

Describe the bug
When using lists with linebreak separation, Marked adds unnecessary <p> tags to list items.

To Reproduce
Using CommonMark, the following adds erroneous <p> tags around the BBB, DDD, and EEE elements.
Using MarkedDemo, the following adds <p> tags around AAA (correct) and BBB (incorrect).

## Testing

* AAA

* BBB
    * CCC
* DDD
* EEE

Expected behavior
With the above code, only AAA should have <p> element wrappers.

** Additional Example **

## Testing

* AAA
* BBB
    * CCC
* DDD

* EEE

Above, CommonMark adds around AAA, BBB, DDD, EEE.
Above, MarkedDemo adds around DDD, and EEE

@UziTech
Copy link
Member

UziTech commented Jun 27, 2018

Why is it incorrect to add <p> tags around BBB, DDD, and EEE? Is this in the spec somewhere?

CommonMark demo
Marked demo

@utdrmac
Copy link
Author

utdrmac commented Jun 27, 2018

Because that doesn't make any sense. I put a new line between AAA and BBB, so why are other list items being affect by this?

@utdrmac
Copy link
Author

utdrmac commented Jun 27, 2018

Similar situation: commonmark
There's a line break before EEE, so why are other elements also getting p tags? If you remove this line break, all p tags disappear. It is inconsistent behavior.

@UziTech UziTech added the L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue label Jun 27, 2018
@UziTech
Copy link
Member

UziTech commented Jun 27, 2018

according to the spec:

A list is loose if any of its constituent list items are separated by blank lines

... paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.

So CommonMark seems to do it correctly.

Marked should include <p> tags on all first level list items in the demo.

@utdrmac
Copy link
Author

utdrmac commented Jun 27, 2018

That's very odd. I'd like to see a real-world use case where having a line break on the last element of a list should affect every element that comes before or after it, instead of just affecting 'it'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: lists L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants