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

Multiple Elements with the same Fragment Value Appear in Different Fragment #264

Open
xusine opened this issue Nov 29, 2020 · 2 comments
Open

Comments

@xusine
Copy link

xusine commented Nov 29, 2020

Following the #145 I can build a fragment list like this:

  <h1>Fragmented list</h1>
  <ul>
    <li data-marpit-fragment="1">One</li>
    <li data-marpit-fragment="2">Two</li>
    <li data-marpit-fragment="2">Two Again!</li>
  </ul>

Based on my understanding, the second item and third item should appear at the same time because both of them have the fragment id 2. However, when exporting HTML, they don't.

I know I can group the last two items by a div like this to achieve my goal:

<ul>
  <li data-marpit-fragment="1">One</li>
  <div data-marpit-fragment="2">
  <li>Two</li>
  <li>Two Again!</li>
  </div>
</ul>

But I'm still curious why we can not automatically "group" them by given the same fragment id.

@yhatt
Copy link
Member

yhatt commented Nov 29, 2020

Index numbers in data-marpit-fragment are just a hint for integrated apps, and whether they followed the specified group number is depending on their implementation.

In the case of Marp (CLI), it's just based on the order of DOM and will ignore the value of dataset because we think it's a pain to change index numbers manually whenever added or removed fragmented list items. In fact, the solution of #195 shows we don't require fragment index.

The hybrid solution to recognize both of specific index number and no index number is looks like good, but may break exist slides so we are not actively to work for now.

Implementation in Marp CLI is here. Marpit is just creating HTML structure and there are no logics to control the state of fragments.

@xusine
Copy link
Author

xusine commented Nov 29, 2020

@yhatt Thank you for your detailed reply!

From my experience, there is little possibility to use the fragment with the specific index number (for well-controlled order) and without index number (for convenience and by default) in one slide at the same time. Maybe we can add a directive so that user could decide which style of fragment is used in the slide. Just a simple suggestion.

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

2 participants