mirror of
https://github.com/tcsenpai/obsidiangarden_netlify.git
synced 2025-06-06 20:55:21 +00:00
Add support for slashes in tags
This commit is contained in:
parent
3176a78c03
commit
255e1d531d
@ -8,6 +8,8 @@ const { parse } = require("node-html-parser");
|
|||||||
|
|
||||||
const { headerToId, namedHeadingsFilter } = require("./src/helpers/utils");
|
const { headerToId, namedHeadingsFilter } = require("./src/helpers/utils");
|
||||||
|
|
||||||
|
const tagRegex = /(^|\s|\>)(#[^\s!@#$%^&*()=+\.,\[{\]};:'"?><]+)(?!([^<]*>))/g;
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
let markdownLib = markdownIt({
|
let markdownLib = markdownIt({
|
||||||
breaks: true,
|
breaks: true,
|
||||||
@ -194,7 +196,7 @@ module.exports = function (eleventyConfig) {
|
|||||||
return (
|
return (
|
||||||
str &&
|
str &&
|
||||||
str.replace(
|
str.replace(
|
||||||
/(^|\s|\>)(#[^\s!@#$%^&*()=+\.\/,\[{\]};:'"?><]+)(?!([^<]*>))/g,
|
tagRegex,
|
||||||
function (match, precede, tag) {
|
function (match, precede, tag) {
|
||||||
return `${precede}<a class="tag" onclick="toggleTagSearch(this)">${tag}</a>`;
|
return `${precede}<a class="tag" onclick="toggleTagSearch(this)">${tag}</a>`;
|
||||||
}
|
}
|
||||||
@ -207,7 +209,7 @@ module.exports = function (eleventyConfig) {
|
|||||||
let match =
|
let match =
|
||||||
str &&
|
str &&
|
||||||
str.match(
|
str.match(
|
||||||
/(^|\s|\>)(#[^\s!@#$%^&*()=+\.\/,\[{\]};:'"?><]+)(?!([^<]*>))/g
|
tagRegex,
|
||||||
);
|
);
|
||||||
if (match) {
|
if (match) {
|
||||||
tags = match
|
tags = match
|
||||||
|
Loading…
x
Reference in New Issue
Block a user