FormidableLabs/spectacle

Using SlideLayout API with MDX slides

ricovitch opened this issue · 8 comments

Question

Is it possible to use Slide Layouts when writing slides in MDX ?

Background Info/Attempts

Not sure what's the best approach to manage different slide layouts with MDX.
The documented Slide Layouts looks to fit very well my needs, but it does not seem to be available when writing slides in MD/MDX, or I may be missing something.

I imagine another approach could be to use some custom html/css or react component, but we loose a bit the simplicity of markdown content.

Yeah it's something we've talked about internally but it almost necessitates introducing some new custom syntax into Markdown. Happy to think through some ideas here. We sort of already do that with slide breaks, so it's not without precedence.

Hi Carlos.
Thank you for answering and confirming that it's not supported yet.

I would be happy with some kind of "json decorators" for slide breaks like below.
This would also open the door to other parameters.

--- { layout: "statement" }

Statement text

Or frontmatter syntax between two delimiters.

---
layout: "statement"
---

Statement text

The complex part with markdown is column/grid based layouts maybe as it would require some other kind of delimiters.
Maybe a subset of the SlideLayouts API could be supported ? (those that don't need delimiters to separate blocks / columns)

I like the JSON decorators idea, I think the second one might be a bit trickier to get right in every instance to ensure it doesn't get thought of just as a slide.

We've started to integrate some of the slide layouts using the Markdown decorators:
#1289

Not released yet, but you can see where this API is likely heading.

That is awesome, thank you so much for taking my feedback into consideration.
I'm sure a lot of people will like it !

@ricovitch Yeah, we've released discretely the first part of it, and when we get more types implemented we'll update the docs. Feel free to kick the tires and let us know if you see anything.

Check out our docs which show how to leverage slide layouts in markdown → https://formidable.com/open-source/spectacle/docs/md-slide-layouts

We plan to add more types in the future as well!

Awesome thank you !