eval code examples in documentation

This commit is contained in:
2023-08-27 00:11:01 +02:00
parent b62f0d7aa0
commit 52c7d4c091
3 changed files with 30 additions and 44 deletions

View File

@ -78,6 +78,7 @@ export class Editor {
userPlugins: Extension[] = [];
state: EditorState;
api: UserAPI;
selectedExample: string | null = "";
docs: { [key: string]: string } = {};
// Audio stuff
@ -677,13 +678,8 @@ export class Editor {
const converted_markdown = converter.makeHtml(
this.docs[this.currentDocumentationPane]
);
function wrapCodeWithPre(inputString: string): string {
let newString = inputString.replace(/<code>/g, "<pre><code>");
newString = newString.replace(/<\/code>/g, "</code></pre>");
return newString;
}
document.getElementById("documentation-content")!.innerHTML =
wrapCodeWithPre(converted_markdown);
converted_markdown;
}
changeToLocalBuffer(i: number) {