diff --git a/assets/js/popover.js b/assets/js/popover.js
index 94edc3df3..6fec7e5e0 100644
--- a/assets/js/popover.js
+++ b/assets/js/popover.js
@@ -7,7 +7,6 @@ function htmlToElement(html) {
function initPopover(baseURL, useContextualBacklinks, renderLatex) {
const basePath = baseURL.replace(window.location.origin, "")
- const regex = /\[!.+\]-? /;
fetchData.then(({ content }) => {
const links = [...document.getElementsByClassName("internal-link")]
links
@@ -18,7 +17,7 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
const linkDest = content[li.dataset.src]
const popoverElement = `
${linkDest.title}
-
${highlight(removeMarkdown(linkDest.content), li.dataset.ctx).replace(regex, "")}...
+
${highlight(removeMarkdown(linkDest.content), li.dataset.ctx)}...
${new Date(linkDest.lastmodified).toLocaleDateString()}
`
el = htmlToElement(popoverElement)
@@ -27,7 +26,7 @@ function initPopover(baseURL, useContextualBacklinks, renderLatex) {
if (linkDest) {
const popoverElement = `
${linkDest.title}
-
${removeMarkdown(linkDest.content).split(" ", 20).join(" ").replace(regex, "")}...
+
${removeMarkdown(linkDest.content).split(" ", 20).join(" ")}...
${new Date(linkDest.lastmodified).toLocaleDateString()}
`
el = htmlToElement(popoverElement)
diff --git a/assets/js/search.js b/assets/js/search.js
index bca57b3b1..289b78e33 100644
--- a/assets/js/search.js
+++ b/assets/js/search.js
@@ -45,6 +45,7 @@ const removeMarkdown = (
.replace(/(`{3,})(.*?)\1/gm, "$2")
.replace(/`(.+?)`/g, "$1")
.replace(/\n{2,}/g, "\n\n")
+ .replace(/\[![a-zA-Z]+\]-? /g, "")
} catch (e) {
console.error(e)
return markdown
@@ -138,7 +139,7 @@ const highlight = (content, term) => {
}
const resultToHTML = ({ url, title, content, term }) => {
- const regex = /\[!.+\]-? /;
+ const regex = /\[![a-zA-z]\]-? /;
const text = removeMarkdown(content)
const resultTitle = highlight(title, term)
const resultText = highlight(text, term)
diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index aea3cec29..e1a522586 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -67,7 +67,7 @@
{{ $finder = index $blockquoteclasses1 $counter }}
{{ if (in $finder "[!") }}
{{ $inner := index $blockquoteclasses $counter1 }}
- {{ $inner = $inner | replaceRE `\[!(.+)\]` `${1}` }}
+ {{ $inner = $inner | replaceRE `\[!([a-zA-Z]+)\]` `${1}` }}
{{ $inner = printf "blockquote class=%s-callout" $inner}}
{{ $content = replace $content . $inner 1}}
{{ $counter1 = add $counter1 1 }}
@@ -77,7 +77,7 @@
{{ end }}
{{ $counter = add $counter 1 }}
{{end}}
-{{ $content = $content | replaceRE `\[!.+\]-?` "" }}
+{{ $content = $content | replaceRE `\[![a-zA-Z]+\]-?` "" }}
{{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
{{ $content | safeHTML }}