Open alex-rozenshteyn-leapyear opened 5 years ago
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.
For those who wonders, --html
for Marp for VS Code
can be enabled via the settings key markdown.marp.enableHtml
.
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.
Fragmented lists are great! Sometimes, though, I want to display the whole list at once. For example:
press right arrow
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.