feat: Replace == with <mark> (#234)

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 5c8bed5c6a
commit 64c3e75651
3 changed files with 13 additions and 0 deletions

View File

@ -619,3 +619,7 @@ header {
} }
} }
mark {
background-color: var(--highlighted);
color: var(--gray);
}

View File

@ -11,6 +11,7 @@
--lightgray: #f0f0f0; --lightgray: #f0f0f0;
--outlinegray: #dadada; --outlinegray: #dadada;
--million-progress-bar-color: var(--secondary); --million-progress-bar-color: var(--secondary);
--highlighted: #f5dfaf88;
} }
[saved-theme="dark"] { [saved-theme="dark"] {
@ -23,6 +24,7 @@
--gray: #d4d4d4 !important; --gray: #d4d4d4 !important;
--lightgray: #292633 !important; --lightgray: #292633 !important;
--outlinegray: #343434 !important; --outlinegray: #343434 !important;
--highlighted: #574010;
} }

View File

@ -96,4 +96,11 @@
{{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }} {{ $content = $content | replaceRE "blockquote class=callout" "blockquote" }}
{{end}} {{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 }} {{ $content | safeHTML }}