Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(skills): support names beginning with digits #9244

Mergedamiralibg(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/9244/headmerged by juliusmarminge View on GitHub

Showing 11 changed files with 40 additions and 2 deletions (loading 8).

x
0 of 11 viewed, 11 left
2 additions and 1 deletionapps/mobile/modules/t3-markdown-text/src/nativeMarkdownText.tsModified
View file
@@ -195,7 +195,8 @@
return runs;
​
-const SKILL_TOKEN_REGEX = /(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;
+const SKILL_TOKEN_REGEX =
+ /(^|\s)\$(?![0-9][0-9_]*(?:[kKmMbBtT]|[eE][0-9]+)?(?:\s|$))(?=[a-zA-Z0-9:_-]*[a-zA-Z])([a-zA-Z0-9][a-zA-Z0-9:_-]*)(?=\s|$)/g;
​
function formatSkillLabel(skill: SelectableMarkdownSkill): string {
const displayName = skill.displayName?.trim();
23 additions and 0 deletionsapps/mobile/src/lib/nativeMarkdownText.test.tsModified
View file
@@ -226,6 +226,29 @@
]);
});
​
+ it("decorates known skill references that begin with a digit", () => {
+ const node: MarkdownNode = {
+ type: "document",
+ children: [
+ {
+ type: "paragraph",
+ children: [{ type: "text", content: "Use $2spec for this." }],
+ },
+ ],
+ };
+​
+ expect(nativeMarkdownDocumentRuns(node, [{ name: "2spec", displayName: "2Spec" }])).toEqual([