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(/(`{3,})(.*?)\1/gm, "$2")
|
||||||
.replace(/`(.+?)`/g, "$1")
|
.replace(/`(.+?)`/g, "$1")
|
||||||
.replace(/\n{2,}/g, "\n\n")
|
.replace(/\n{2,}/g, "\n\n")
|
||||||
.replace(/\[![a-zA-Z]+\]-? /g, "")
|
.replace(/\[![a-zA-Z]+\][-\+]? /g, "")
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
return markdown
|
return markdown
|
||||||
@ -139,7 +139,7 @@ const highlight = (content, term) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const resultToHTML = ({ url, title, content, term }) => {
|
const resultToHTML = ({ url, title, content, term }) => {
|
||||||
const regex = /\[![a-zA-z]\]-? /;
|
const regex = /\[![a-zA-z]\][-\+]? /;
|
||||||
const text = removeMarkdown(content)
|
const text = removeMarkdown(content)
|
||||||
const resultTitle = highlight(title, term)
|
const resultTitle = highlight(title, term)
|
||||||
const resultText = highlight(text, term)
|
const resultText = highlight(text, term)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
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>
|
<title>
|
||||||
{{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{
|
{{ if .Title }}{{ .Title }}{{ else }}{{ $.Site.Data.config.page_title }}{{
|
||||||
|
|||||||
@ -78,7 +78,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ $counter = add $counter 1 }}
|
{{ $counter = add $counter 1 }}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ $content = $content | replaceRE `\[![a-zA-Z]+\]-?` "" }}
|
{{ $content = $content | replaceRE `\[![a-zA-Z]+\][-\+]?` "" }}
|
||||||
{{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
|
{{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user