Updated Regex

This commit is contained in:
saberzero1 2022-07-30 17:47:21 +02:00
parent 10540c1c27
commit 1f8a8a2fe7
No known key found for this signature in database
GPG Key ID: D2C0887768D969D8
3 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -3,7 +3,7 @@
<meta charset="UTF-8" />
<meta
name="description"
content="{{if .IsHome}}{{$.Site.Data.config.description}}{{else}}{{ replaceRE ` \[!.+\]-? ` `` .Summary }}{{end}}"
content="{{if .IsHome}}{{$.Site.Data.config.description}}{{else}}{{ replaceRE ` \[!.+\][-\+]? ` `` .Summary }}{{end}}"
/>
<title>
{{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{

View File

@ -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}}