Skip to content

Commit

Permalink
🎉 Feat: add more type marked text support
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Nov 4, 2024
1 parent 41014f7 commit 712cf2a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 14 additions & 0 deletions assets/css/_page/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,20 @@
}
}

mark {
padding: 0.14em 0.28em;
background-color: var(--#{$prefix}mark-background-color, mark);
color: var(--#{$prefix}mark-color, marktext);
@include border-radius($global-border-radius);

@each $color, $value in $theme-colors {
&.mark-#{$color} {
--#{$prefix}mark-color: #fff;
--#{$prefix}mark-background-color: var(--#{$prefix}#{$color});
}
}
}

.table-wrapper {
overflow-x: auto;
--#{$prefix}scrollbar-thumb-color: #{$table-background-color};
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/function/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{- end -}}

{{- $content = partial "function/task-lists.html" $content -}}

{{- $content = partial "function/marked-text.html" $content -}}
{{- $content = partial "function/escape.html" $content -}}

{{- end -}}
Expand Down
10 changes: 10 additions & 0 deletions layouts/partials/function/marked-text.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- /*
Marked texts rendering
This is an experimental syntax highlighting for the marked texts.
Embed types: default, primary, secondary, success, warning, danger
*/ -}}

{{- $content := replaceRE `<mark>(.+?)</mark>\[(.+?)\]` `<mark class="mark-$2">$1</mark>` . -}}
{{- $content = replaceRE `<mark>(.+?)</mark>` `<mark class="mark-default">$1</mark>` $content -}}

{{- return $content -}}

0 comments on commit 712cf2a

Please sign in to comment.