Skip to content

Commit 293be4f

Browse files
committed
fix regex for color macro, with support for rgb and hex colors
1 parent 7a61d90 commit 293be4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/markupParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function parseMarkup(sourceUri: vscode.Uri, sourceText: string) {
7575
tag = tag.replace(/~([^~]*)~/g, "<sub>$1</sub>");
7676
tag = tag.replace(/\{{2}([^{{2}]*)\}{2}/g, `<code style='font-family: ${MONOSPACE_FONT_FAMILY}'>$1</code>`);
7777
tag = tag.replace(/\?{2}(.*)\?{2}/g, "<cite>$1</cite>");
78-
tag = tag.replace(/\{color:(\w+)\}(.*)\{color\}/g, "<span style='color:$1;'>$2</span>");
78+
tag = tag.replace(/\{color:([^}]+)\}/g, "<span style='color:$1;'>").replace(/\{color\}/g, '</span>');
7979

8080
tag = tag.replace(/bq. (.*)/g, "<blockquote><p>$1</p></blockquote>");
8181
tag = tag.replace(/\{quote\}(.*)\{quote\}/g, "<blockquote><p>$1</p></blockquote>");

0 commit comments

Comments
 (0)