Skip to content

Commit 06a13d2

Browse files
committed
Simplified UFM regular expression
1 parent 19c73e6 commit 06a13d2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/packages/ufm/plugins/marked-ufm.plugin.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@ export function ufm(plugins: Array<UfmPlugin> = []): MarkedExtension {
1616
return {
1717
name: alias,
1818
level: 'inline',
19-
start: (src: string) => {
20-
const regex = new RegExp(`\\{${marker}`);
21-
const match = src.match(regex);
22-
return match ? match.index : -1;
23-
},
24-
tokenizer(src: string): Tokens.Generic | undefined {
25-
const pattern = `^(?<!\\\\){{?${marker}((?:[a-zA-Z][\\w-]*|[\\{].*?[\\}]+|[\\[].*?[\\]])+)(?<!\\\\)}}?`;
19+
start: (src: string) => src.indexOf(`{${marker}`),
20+
tokenizer: (src: string) => {
21+
const pattern = `^\\{${marker}([^}]*)\\}`;
2622
const regex = new RegExp(pattern);
2723
const match = src.match(regex);
2824

0 commit comments

Comments
 (0)