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

Allow for fragmented list from a directive #357

Open
thejcannon opened this issue Mar 30, 2023 · 4 comments
Open

Allow for fragmented list from a directive #357

thejcannon opened this issue Mar 30, 2023 · 4 comments

Comments

@thejcannon
Copy link

👋

Howdy! Trying out Marp and I'm liking it so far.

One issue I've run into is that Prettier pretty unambiguously formats unordered lists using a hyphen -, which means it doesn't play nicely with Marp's fragmented list.

Here's some relevant issues:

Support for a directive would solve the corss-roads of Prettier and Marp, and as mentioned in the second link, would be very explicit.

Thanks!

@thejcannon
Copy link
Author

I should add, the current workaround is:

<!-- prettier-ignore -->
* one
* two
* three

@yhatt
Copy link
Member

yhatt commented Mar 30, 2023

Thank you for reminding me. As you said, a configurable fragmented list was there on the far of the roadmap.

NOTE: The defined markups may be an opinionated. I want to start with a dogmatic parser for aiming to less-configuration, but it may change the target character, or make the markup configurable by global directives.

#148

One of the ideas I had been thought at that time is to specify a marker symbol via the global/local directive. The Markdown author can control a marker for the fragmented list as like that:

<!-- fragmentMarker: "-" -->

- Step 1
- Step 2
- Step 3

---

<!-- fragmentMarker: ["-", "*"] -->

- Step 1
  - Step 1-1
  - Step 1-2
* Step 2
  * Step 2-1
  * Step 2-2

This idea is using Marp's existing directive syntax.

And the member of Prettier @kachkaev provides another interesting idea:

My suggestion would be to reach out to Marpit folks and suggest some alternative syntax for fragmented lists. For example, this can be - <!-- click --> list item, which is explicit about what it does. This will surface the knowledge, so make Marpit markdowns less cryptic for folks who haven’t read the docs.

prettier/prettier#11304 (comment)

- <!-- fragmented --> Step 1
- <!-- fragmented --> Step 2
- <!-- fragmented --> Step 3

(Marpit framework does not limit how to proceed the fragmented list so I use more inclusive word fragmented instead of click)

Pros: Explicit and never break any existing CommonMark rules. Annotating the list item with HTML comment is similar approach to Marp Core's fitting header <!-- fit --> so many Marp(it) users may be easy to know.

Cons: Looks like a bit redundant. The marker * will no longer work as the fragmented list so it may break compatibillity with hundreds of existing Marp Markdowns..

@thejcannon
Copy link
Author

Correct me if I'm wrong, but couldn't you support both:

  • * means fragmented list
  • - <!-- fragmented --> ... ALSO means fragmented list

Then you won't break compatibility and Prettier is still happy.


I honestly don't have a strong opinion. The tool already does a good job so I'm inclined to just go along with whatever works 😄 👍

@codingluke
Copy link

codingluke commented Nov 2, 2023

I can only support @thejcannon's proposal. I just started to use fragmented lists together with prettier and landed here ;)

The comment per item is more flexible so I would prefere it over the fragmentMarker proposal. even though this would be in 99% more convenient. Best would be to support all 😅

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

No branches or pull requests

3 participants