From 1f8a8a2fe7ae1a971fe6558ba8b4e6e3bf82583a Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Sat, 30 Jul 2022 17:47:21 +0200 Subject: [PATCH] Updated Regex --- assets/js/search.js | 4 ++-- layouts/partials/head.html | 2 +- layouts/partials/textprocessing.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/js/search.js b/assets/js/search.js index 289b78e33..3baed8d65 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -45,7 +45,7 @@ const removeMarkdown = ( .replace(/(`{3,})(.*?)\1/gm, "$2") .replace(/`(.+?)`/g, "$1") .replace(/\n{2,}/g, "\n\n") - .replace(/\[![a-zA-Z]+\]-? /g, "") + .replace(/\[![a-zA-Z]+\][-\+]? /g, "") } catch (e) { console.error(e) return markdown @@ -139,7 +139,7 @@ const highlight = (content, term) => { } const resultToHTML = ({ url, title, content, term }) => { - const regex = /\[![a-zA-z]\]-? /; + const regex = /\[![a-zA-z]\][-\+]? /; const text = removeMarkdown(content) const resultTitle = highlight(title, term) const resultText = highlight(text, term) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index f6e9ce11e..3f0566855 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -3,7 +3,7 @@ {{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{ diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html index 7fe118a77..92477d442 100644 --- a/layouts/partials/textprocessing.html +++ b/layouts/partials/textprocessing.html @@ -78,7 +78,7 @@ {{ end }} {{ $counter = add $counter 1 }} {{end}} - {{ $content = $content | replaceRE `\[![a-zA-Z]+\]-?` "" }} + {{ $content = $content | replaceRE `\[![a-zA-Z]+\][-\+]?` "" }} {{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }} {{end}}