chore(client/ts): port services/mermaid

This commit is contained in:
Elian Doran 2024-12-21 22:39:28 +02:00
parent f4c73d45c7
commit c93fcc6988
No known key found for this signature in database
2 changed files with 13 additions and 1 deletions

View File

@ -11,7 +11,7 @@ let elkLoaded = false;
*
* @param mermaidContent the plain text of the mermaid diagram, potentially including a frontmatter.
*/
export async function loadElkIfNeeded(mermaidContent) {
export async function loadElkIfNeeded(mermaidContent: string) {
if (elkLoaded) {
// Exit immediately since the ELK library is already loaded.
return;

View File

@ -128,8 +128,20 @@ declare global {
securityLevel: "antiscript"
}): void;
render(selector: string, data: string);
}
interface MermaidLoader {
}
var mermaid: {
mermaidAPI: MermaidApi;
registerLayoutLoaders(loader: MermaidLoader);
parse(content: string, opts: {
suppressErrors: true
}): {
config: {
layout: string;
}
}
};
var MERMAID_ELK: MermaidLoader;
}