+import { params, searchSortOptions } from "../../constants.js";
+
import router from "../../router.js";
/*
}
function parseTagLink(source) {
- const matched = source.matchAll(/(?:^|\s)(#[a-zA-Z0-9_-]+)(?=\s|$)/g);
- if (matched) {
- return Array.from(matched).map((match) => {
- const text = match[1];
- return {
- text,
- range: [match.index + match[0].indexOf(text), match.index + match[0].indexOf(text) + text.length - 1],
- url: `${router.resolve({ name: "search", query: { term: text } }).href}`,
- };
- });
- }
-
- return null;
+ const matched = source.matchAll(/(?:^|\s)(#[a-zA-Z0-9_-]+)(?=\s|$)/g);
+ if (matched) {
+ return Array.from(matched).map((match) => {
+ const text = match[1];
+ return {
+ text,
+ range: [
+ match.index + match[0].indexOf(text),
+ match.index + match[0].indexOf(text) + text.length - 1,
+ ],
+ url: `${
+ router.resolve({
+ name: "search",
+ query: {
+ [params.searchTerm]: text,
+ [params.sortBy]: searchSortOptions.title,
+ },
+ }).href
+ }`,
+ };
+ });
}
+ return null;
+}
+
function extendedAutolinks(source) {
return [
...parseUrlLink(source),