mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
Updated Regex
This commit is contained in:
parent
10540c1c27
commit
1f8a8a2fe7
@ -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)
|
||||
|
||||
@ -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 }}{{
|
||||
|
||||
@ -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}}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user