Skip to content

Present My Code

  1. Save the script below in your project as genaisrc/slides.genai.js.

    slides.genai.mjs
    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 SOURCE
    in 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.
    `
  2. Right click on the code file or folder, select Run GenAIScript… and select Generate Slides.

  3. Apply the refactoring to save the generated slides file.

  4. To visualize the slides, install the vscode-reveal extension. Open the slides file and click slides in the status bar.