Use basePaths constant when constructing wikilink
authorAdam Dullage <redacted>
Wed, 22 Nov 2023 16:46:11 +0000 (16:46 +0000)
committerAdam Dullage <redacted>
Wed, 22 Nov 2023 16:46:11 +0000 (16:46 +0000)
flatnotes/src/autolinkParsers.js

index aaf74a43cb43c1ea546f95e7785ceeec3f0be1e5..37ae692ccbd641f331a1ecb9bbfe4982e86c9a81 100644 (file)
@@ -1,3 +1,5 @@
+import { basePaths } from "./constants";
+
 function parseWikiLink(source) {
   const matched = source.matchAll(/\[\[(.*)\]\]/g);
   if (matched) {
@@ -5,7 +7,7 @@ function parseWikiLink(source) {
       const text = match[1];
       return {
         text,
-        url: encodeURI(`/note/${text.trim()}`),
+        url: encodeURI(`${basePaths.note}/${text.trim()}`),
         range: [match.index, match.index + match[0].length - 1],
       };
     });
@@ -24,10 +26,10 @@ export function extendedAutolinks(source) {
 
 /*
  * Sourced from toast-ui. There autolink options are
- * either override their built in functionality or 
+ * either override their built in functionality or
  * use their built in functionality. We'd like to have
  * both so this is the source of their parsers.
-*/
+ */
 const DOMAIN = '(?:[w-]+.)*[A-Za-z0-9-]+.[A-Za-z0-9-]+';
 const PATH = '[^<\\s]*[^<?!.,:*_?~\\s]';
 const EMAIL = '[\\w.+-]+@(?:[\\w-]+\\.)+[\\w-]+';
git clone https://git.99rst.org/PROJECT