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

option to disable "tight lists" #475

Open
makoConstruct opened this issue Sep 3, 2020 · 7 comments
Open

option to disable "tight lists" #475

makoConstruct opened this issue Sep 3, 2020 · 7 comments

Comments

@makoConstruct
Copy link

Markdown is... I think it's fair enough to say that it is inconsistent about whether or not it will wrap a list item in a <p>. There are rules, but they're not intuitive, for me they aren't lining up with what I want the software to do at all.

There doesn't seem to be a way to get it to <p> the list list items in lists of one, leading lone list items to look like an inconsistency in the document where the usual padding between sections of text is just mysteriously missing.

Clearly what I want is for us to condemn and abandon the standard behaviour as a default, but that doesn't seem to be what this project is about, so I'll instead ask if we'd be alright with a parser option that assumes loose lists in all cases.

@makoConstruct
Copy link
Author

Workaround: Typing <p> at the beginning of the single list item. For some reason, it does not cause the list item to be redundantly wrapped in any additional <p> if the list later becomes loose.

@oberien
Copy link
Contributor

oberien commented Sep 3, 2020

I'm on the other camp. I'd like to never have loose lists. I don't like how the following gets translated with CommonMark:

* first 1
* second 1


* first 2
* second 2

I'd like those to be two differrent tight lists instead of being parsed and converted as a single loose list.

@raphlinus
Copy link
Collaborator

raphlinus commented Sep 3, 2020

My personal feeling is that having a lot of inconsistent variants is bad for the ecosystem, and that the standardization effort of CommonMark is worthwhile even if people dislike the resulting color of the bike shed.

So no, very unlikely we'll add options that change core functionality. A completely different story for extensions, though, as those are quite important, and the CommonMark people are very conservative about bringing those into their fold.

Another thought: if you really want this functionality, it should be possible to do it as a postprocessing phase, ie an iterator-to-iterator transformer. Just inject (or delete, as preferences indicate) Paragraph tags after Item tags.

@makoConstruct
Copy link
Author

makoConstruct commented Sep 5, 2020

Okay I just realized that putting a <p> at the start of the list item disables markdown formatting for the rest of the line, and presumably so would any simple injection of a Paragraph tag in postprocessing? I really hate it.

I should mention I could definitely respect an only tight lists option too. I think I'd be fine with that.

@crlf0710
Copy link

crlf0710 commented Sep 5, 2020

Actually the spec is quite clear that Item is a container block - it can not directly contain Texts without an intermediate Paragraph or so...

@marcusklaas
Copy link
Collaborator

@crlf0710 This is an interesting observation. Indeed, dingus emits paragraphs even for tight lists. It is only for HTML generation that it strips them. Pulldown does 'tree surgery' to remove the paragraphs before they are emitted.

@crlf0710
Copy link

crlf0710 commented Sep 5, 2020

Actually i'm trying to build an "markdown ast" crate for my own use, and I'm currently working on recovering these paragraph tags from pulldown_cmark result...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants