Skip to content

Commit

Permalink
feat: Replace == with <mark> (jackyzha0#234)
Browse files Browse the repository at this point in the history
Co-authored-by: SAF <[email protected]>
  • Loading branch information
SafEight and SAF authored Nov 19, 2022
1 parent 7f9f588 commit de2b6b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assets/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,7 @@ header {
}
}

mark {
background-color: var(--highlighted);
color: var(--gray);
}
2 changes: 2 additions & 0 deletions assets/styles/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
--lightgray: #f0f0f0;
--outlinegray: #dadada;
--million-progress-bar-color: var(--secondary);
--highlighted: #f5dfaf88;
}

[saved-theme="dark"] {
Expand All @@ -23,6 +24,7 @@
--gray: #d4d4d4 !important;
--lightgray: #292633 !important;
--outlinegray: #343434 !important;
--highlighted: #574010;
}


Expand Down
7 changes: 7 additions & 0 deletions layouts/partials/textprocessing.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit de2b6b9

Please sign in to comment.