Only consider single words as inline snippets

Optionally surrounded by whitespace.
This mirrors the restrictions on !!snippets.
cshd
Dragory 2020-10-21 22:30:38 +03:00
parent 9a88a6ef89
commit 3e44416077
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
1 changed files with 2 additions and 1 deletions

View File

@ -207,8 +207,9 @@ class Thread {
}, {});
text = text.replace(
new RegExp(`${config.inlineSnippetStart}(.+?)${config.inlineSnippetEnd}`, "i"),
new RegExp(`${config.inlineSnippetStart}(\\s*\\S+?\\s*)${config.inlineSnippetEnd}`, "i"),
(orig, trigger) => {
trigger = trigger.trim();
const snippet = snippetMap[trigger.toLowerCase()];
return snippet != null ? snippet.body : orig;
}