#310 Update wikilink regex to ignore empty brackets
authorAdam Dullage <redacted>
Wed, 21 May 2025 11:41:21 +0000 (12:41 +0100)
committerAdam Dullage <redacted>
Wed, 21 May 2025 11:41:21 +0000 (12:41 +0100)
client/components/toastui/extendedAutolinks.js

index 7e2c73f214b36dcbd517c2db406b996a86a52fce..ef2fd51b50ce38c172053767cdb9c24cac605004 100644 (file)
@@ -76,7 +76,7 @@ export function parseUrlLink(source) {
 // end of raw toast-ui source
 
 function parseWikiLink(source) {
-  const matched = source.matchAll(/\[\[(.*?)\]\]/g);
+  const matched = source.matchAll(/\[\[\s*(\S(?:[^\[\]]*?\S)?)\s*\]\]/g);
   if (matched) {
     return Array.from(matched).map((match) => {
       const text = match[1];
git clone https://git.99rst.org/PROJECT