SafEight
2022-11-19 de2b6b9a1b95cb6af7eb421d9a4de054e7e41315
feat: Replace == with <mark> (#234)

Co-authored-by: SAF <saf@saf.saf>
3 files modified
13 ■■■■■ changed files
assets/styles/base.scss 4 ●●●● patch | view | raw | blame | history
assets/styles/custom.scss 2 ●●●●● patch | view | raw | blame | history
layouts/partials/textprocessing.html 7 ●●●●● patch | view | raw | blame | history
assets/styles/base.scss
@@ -619,3 +619,7 @@
  }
}
mark {
  background-color: var(--highlighted);
  color: var(--gray);
}
assets/styles/custom.scss
@@ -11,6 +11,7 @@
  --lightgray: #f0f0f0;
  --outlinegray: #dadada;
  --million-progress-bar-color: var(--secondary);
  --highlighted: #f5dfaf88;
}
[saved-theme="dark"] {
@@ -23,6 +24,7 @@
  --gray: #d4d4d4 !important;
  --lightgray: #292633 !important;
  --outlinegray: #343434 !important;
  --highlighted: #574010;
}
layouts/partials/textprocessing.html
@@ -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 }}