From 41fb82b9d2bb71e0841e8950edb30d746835142b Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 25 Jul 2023 10:52:14 +0200 Subject: [PATCH] Restrict attribute names --- common/markdown_parser/parser.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/markdown_parser/parser.ts b/common/markdown_parser/parser.ts index aaa98a8..a5058f5 100644 --- a/common/markdown_parser/parser.ts +++ b/common/markdown_parser/parser.ts @@ -142,7 +142,7 @@ export const Highlight: MarkdownConfig = { ], }; -export const attributeRegex = /^\[([^:]+)(::\s*)([^\]]+)\]/; +export const attributeRegex = /^\[(\w+)(::\s*)([^\]]+)\]/; export const Attribute: MarkdownConfig = { defineNodes: [ @@ -164,7 +164,7 @@ export const Attribute: MarkdownConfig = { ) { return -1; } - const [fullMatch, attributeName, attributeColon, attributeValue] = + const [fullMatch, attributeName, attributeColon, _attributeValue] = match; const endPos = pos + fullMatch.length;