Versions

  • v1

    4/4/2024
    Open: Version
    Changes from v0 to v1
    +190
    -0

    import { FunctionComponent } from "preact";
    import { DIFFICULTIES, TAGS } from "./constants.ts";

    export interface ExampleGroup {
    title: string;
    icon?: FunctionComponent;
    items: Example[];
    }

    export interface Example {
    id: string;
    title: string;
    description: string;
    difficulty: keyof typeof DIFFICULTIES;
    tags: (keyof typeof TAGS)[];
    additionalResources: [string, string][];
    run?: string;
    playground?: string;
    files: ExampleFile[];
    }

    export interface ExampleFile {
    name: string;
    snippets: ExampleSnippet[];
    }

    export interface ExampleSnippet {
    text: string;
    code: string;
    }

    export function parseExample(id: string, file: string): Example {
    // Substitute $std/ with the full import url
    file = file.replaceAll("$std/", "https://deno.land/std@0.207.0/");

    // Extract the multi line JS doc comment at the top of the file
  • v0

    4/4/2024
    Open: Version
    +0
    -0


5
Next
Updated: April 10, 2024