Skip to content

Build your personal knowledge base with Trilium Notes

refactor(markdown): simplify logic for slash commands

Elian Doranb6b07e2e2292
diff --git a/apps/client/src/widgets/type_widgets/code/Markdown.tsx b/apps/client/src/widgets/type_widgets/code/Markdown.tsx
index 8668de7508..684e07280c 100644
--- a/apps/client/src/widgets/type_widgets/code/Markdown.tsx
+++ b/apps/client/src/widgets/type_widgets/code/Markdown.tsx
@@ -478,7 +478,7 @@ function useSlashCommands(parentComponent: TypeWidgetProps["parentComponent"], e
// Suppress slash menu inside fenced/indented code blocks and inline code spans —
// a leading `/` there is part of the code, not a command trigger.
for (let node: SyntaxNode | null = syntaxTree(ctx.state).resolveInner(ctx.pos, -1); node; node = node.parent) {
- if (/Code(Block|Text)|FencedCode|InlineCode/.test(node.name)) return null;
+ if (node.name.includes("Code")) return null;
}
return {