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

More flexible fragments #195

Open
alex-rozenshteyn-leapyear opened this issue Sep 24, 2019 · 3 comments
Open

More flexible fragments #195

alex-rozenshteyn-leapyear opened this issue Sep 24, 2019 · 3 comments

Comments

@alex-rozenshteyn-leapyear

Fragmented lists are great! Sometimes, though, I want to display the whole list at once. For example:

Here's my grocery list:



press right arrow

Here's my grocery list
* Milk
* Eggs

This seems to be a special case of being able to explicitly specify which fragments an element is visible for.

I know LaTeX Beamer has something like this. If there's a way to make it happen, I couldn't see it in the docs.

@yhatt
Copy link
Member

yhatt commented Sep 25, 2019

It's possible by using HTML with data-marpit-fragment attribute directly, only in outputted HTML in Marp CLI (or Marp for VS Code, using Marp CLI internally). It requires to enable HTML (--html).

Here's my grocery list:

<div data-marpit-fragment>

- Milk
- Eggs

</div>

(In CommonMark specification, extra lines around tag are required to render fragmented HTML correctly)

See also an example for fragments in my gist:
https://gistcdn.githack.com/yhatt/efc4ba8999274112072f97c7d48d37df/raw/b01eae1128579ed6be7b447950a256156c49dcaa/fragment.html#5
https://gist.githubusercontent.com/yhatt/efc4ba8999274112072f97c7d48d37df/raw/a146a4250c4f779db934dada36c72392a77159c8/_fragment.md (Last slide)

This usage is the out of recommendation in Marpit because the framework cannot detect the total number of fragments correctly. It's a reason why that is not documented.

@garyng
Copy link

garyng commented Sep 27, 2019

For those who wonders, --html for Marp for VS Code can be enabled via the settings key markdown.marp.enableHtml.

@caph1993
Copy link

For those using vscode (after enabling html), fragments will not work in the preview and also not in the pdf.
But at least, it works if you export your slides as html.

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

4 participants