Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(markdown): add Mermaid to slash commands
Elian Doran5b7f33c81256
diff --git a/apps/client/src/widgets/type_widgets/code/Markdown.tsx b/apps/client/src/widgets/type_widgets/code/Markdown.tsxindex 0f843fb09e..29527b4363 100644--- a/apps/client/src/widgets/type_widgets/code/Markdown.tsx+++ b/apps/client/src/widgets/type_widgets/code/Markdown.tsx@@ -434,6 +434,18 @@ function useSlashCommands(parentComponent: TypeWidgetProps["parentComponent"], e});}},+ {+ label: "/mermaid",+ detail: "Insert a Mermaid diagram",+ apply(view, _completion, from, to) {+ const placeholder = "graph TD\n A --> B";+ const template = `\`\`\`mermaid\n${placeholder}\n\`\`\``;+ view.dispatch({+ changes: { from, to, insert: template },+ selection: { anchor: from + 11, head: from + 11 + placeholder.length }+ });+ }+ },...["note", "tip", "important", "caution", "warning"].map((admonitionType) => ({label: `/${admonitionType}`,detail: `Insert ${admonitionType} admonition`,