diff --git a/src/API.ts b/src/API.ts
index 8c34097..7c14d5a 100644
--- a/src/API.ts
+++ b/src/API.ts
@@ -56,6 +56,18 @@ export class UserAPI {
//this.load = samples("github:tidalcycles/Dirt-Samples/master");
}
+ _executeCodeExample = (code: string) => {
+ console.log("Executing documentation example");
+ this.app.universes[
+ this.app.selected_universe as string
+ ].global.candidate = code as string;
+ tryEvaluate(
+ this.app,
+ this.app.universes[this.app.selected_universe as string].global
+ );
+ };
+
+
_all_samples = (): object => {
return soundMap.get();
};
diff --git a/src/Documentation.ts b/src/Documentation.ts
index d30186a..d00d55e 100644
--- a/src/Documentation.ts
+++ b/src/Documentation.ts
@@ -1,24 +1,10 @@
import { type Editor } from "./main";
+import { tryEvaluate } from "./Evaluator";
const key_shortcut = (shortcut: string): string => {
return `${shortcut}`;
};
-const makeExample = (
- description: string,
- code: string,
- open: boolean = false
-): string => {
- return `
-
- ${description}
-\`\`\`javascript
-${code}
-\`\`\`
-
-`;
-};
-
const samples_to_markdown = (samples: object) => {
let markdownList = "";
let keys = Object.keys(samples);
@@ -51,6 +37,24 @@ const injectAvailableSamples = (application: Editor): string => {
};
export const documentation_factory = (application: Editor) => {
+ const makeExample = (
+ description: string,
+ code: string,
+ open: boolean = false
+ ): string => {
+ return `
+
+${description}
+
+
+
+\`\`\`javascript
+${code}
+\`\`\`
+
+`;
+ };
+
const introduction: string = `
# Welcome