Save the script below in your project as genaisrc/slides.genai.js.
genaisrc/slides.genai.js
script({ title: "Generate Slides", description: "Generate a slide-deck in markdown. Install extension 'vscode-reveal'.", group: "samples", temperature: 0.1, tests: { files: ["src/greeter.ts"], keywords: "greeter", },}) const output = env.files[0].filename + ".slides.md"def( "SOURCE", env.files.filter((f) => !f.filename.endsWith(".slides.md"))) $`Generate a slide deck in markdown format for the content in SOURCEin file ${output} using markdown. - Each slide SHOULD have a title, unless it is only showing a code snippet.- USE heading level 3 for slide titles.- Do NOT add "Slide:" or "Title:" in the slide.- Keep slides titles VERY short.- USE --- to separate slides.- Keep the content on each slide short. Maximum 3 bullet points.- Use mermaid syntax if you need to generate state diagrams, class inheritance diagrams, relationships.- If the source is code, describe the code and show the code in a separate slide.- Keep code snippet short. Maximum 10 lines. Maximum 42 columns. Use multiple slides if needed. Ellipse sections with ... if necessary.- The first slide have a title and a summary of the slide deck.- IGNORE Contributing, Copyright and Trademarks sections.`
Right click on the code file or folder, select Run GenAIScript… and select Generate Slides.
Apply the refactoring to save the generated slides file.
To visualize the slides, install the vscode-reveal extension. Open the slides file and click slides in the status bar.