From: Adam Dullage Date: Wed, 22 Nov 2023 16:46:11 +0000 (+0000) Subject: Use basePaths constant when constructing wikilink X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=054b93b9800526611e4221b5ec2751be8f6eb64d;p=flatnotes.git Use basePaths constant when constructing wikilink --- diff --git a/flatnotes/src/autolinkParsers.js b/flatnotes/src/autolinkParsers.js index aaf74a4..37ae692 100644 --- a/flatnotes/src/autolinkParsers.js +++ b/flatnotes/src/autolinkParsers.js @@ -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]*[^