feat: Replace == with <mark> ()

Co-authored-by: SAF <saf@saf.saf>
This commit is contained in:
SafEight 2022-11-19 21:17:55 +00:00 committed by GitHub
parent 7f9f58860d
commit de2b6b9a1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions
layouts/partials

View file

@ -96,4 +96,11 @@
{{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
{{end}}
{{/* Make ==text== into <mark>text</mark> */}}
{{$mark := findRE "(?Us)==([^\\$]+)==" $content}}
{{range $mark}}
{{$fixed := printf "<mark>%s</mark>" (replace . "==" "")}}
{{$content = replace $content . $fixed}}
{{end}}
{{ $content | safeHTML }}