- first
- second
- third
- forth
- first
- second
- third
- Important feature
local images works too.
| // Raycast extension to create slides from a markdown file. | |
| // Place `index.md` under `~/slides`. | |
| import { Action, ActionPanel, Detail } from "@raycast/api"; | |
| import { useState } from "react"; | |
| import fs from 'fs'; | |
| function Slide({ slide, nextSlide, prevSlide }) { | |
| return ( | |
| <Detail | |
| markdown={slide} | |
| actions={ | |
| <ActionPanel> | |
| <ActionPanel.Section title="bbbb"> | |
| <Action title="Next" shortcut={{ modifiers: [], key: "arrowRight" }} onAction={() => nextSlide()} /> | |
| </ActionPanel.Section> | |
| <ActionPanel.Section title="aaaa"> | |
| <Action title="Prev" shortcut={{ modifiers: [], key: "arrowLeft" }} onAction={() => prevSlide()} /> | |
| </ActionPanel.Section> | |
| </ActionPanel> | |
| } | |
| /> | |
| ); | |
| } | |
| export default function Command() { | |
| const markdown = fs.readFileSync(`${process.env.HOME}/slides/index.md`, "utf-8"); | |
| const slides = markdown.split("\n\n\n"); | |
| const [currentSlide, setCurrentSlide] = useState(0); | |
| const nextSlide = () => { | |
| if (currentSlide < slides.length - 1) { | |
| setCurrentSlide(currentSlide + 1); | |
| } | |
| }; | |
| const prevSlide = () => { | |
| if (currentSlide > 0) { | |
| setCurrentSlide(currentSlide - 1); | |
| } | |
| }; | |
| return <Slide slide={slides[currentSlide]} nextSlide={nextSlide} prevSlide={prevSlide} />; | |
| } |
Great to see this!
maybe we can get you onboard as a contributor!
Unfortunately I'm very busy with other stuff, that's the main reason why this is a gist and not a proper project :)
Cheers!
@marcoieni Awesome idea! I wanted to build something similar and created an extension based on this: raycast/extensions#14883
Instead of new lines as a separator, I went with
---so it can be compatible with Marp. (But I made it configurable, so your format also works)Feel free to add some suggestions, maybe we can get you onboard as a contributor!