From fec0a62b74e45acfe28861ee6eddf493a2be5f74 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Mon, 19 May 2025 07:58:05 +0200 Subject: [PATCH] fix(ofm): allow wikilink alias to be empty (#1984) This is in line with Obsidian's behavior. --- quartz/plugins/transformers/ofm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index e958027ea..ef5917926 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -113,9 +113,9 @@ export const arrowRegex = new RegExp(/(-{1,2}>|={1,2}>|<-{1,2}|<={1,2})/g) // \[\[ -> open brace // ([^\[\]\|\#]+) -> one or more non-special characters ([,],|, or #) (name) // (#[^\[\]\|\#]+)? -> # then one or more non-special characters (heading link) -// (\\?\|[^\[\]\#]+)? -> optional escape \ then | then one or more non-special characters (alias) +// (\\?\|[^\[\]\#]+)? -> optional escape \ then | then zero or more non-special characters (alias) export const wikilinkRegex = new RegExp( - /!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]+)?\]\]/g, + /!?\[\[([^\[\]\|\#\\]+)?(#+[^\[\]\|\#\\]+)?(\\?\|[^\[\]\#]*)?\]\]/g, ) // ^\|([^\n])+\|\n(\|) -> matches the header row