- 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!
Unfortunately I'm very busy with other stuff, that's the main reason why this is a gist and not a proper project :)
Cheers!