mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
math: support Markdown attributes #795
This commit is contained in:
parent
5747ca67d2
commit
345de238c9
4 changed files with 36 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
{{- partial "shortcodes/math.html" (dict
|
{{- partial "shortcodes/math.html" (dict
|
||||||
"page" .Page
|
"page" .Page
|
||||||
"content" .Inner
|
"attributes" .Attributes
|
||||||
"align" (index .Attributes "align")
|
"content" .Inner
|
||||||
|
"align" (index .Attributes "align")
|
||||||
) }}
|
) }}
|
|
@ -57,7 +57,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $options = $otherOptions }}
|
{{- $options = $otherOptions }}
|
||||||
|
|
||||||
{{- /* separate shortcode attributes from rest and put it back to options */}}
|
{{- /* separate shortcode attributes from rest */}}
|
||||||
{{- $title := "" }}
|
{{- $title := "" }}
|
||||||
{{- $wrap := true }}
|
{{- $wrap := true }}
|
||||||
{{- if isset $page.Site.Params "highlightwrap" }}
|
{{- if isset $page.Site.Params "highlightwrap" }}
|
||||||
|
|
|
@ -5,9 +5,28 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $content := .content }}
|
{{- $content := .content }}
|
||||||
{{- $align := .align | default "center" }}
|
{{- $align := .align | default "center" }}
|
||||||
|
|
||||||
|
{{- /* separate shortcode attributes from rest */}}
|
||||||
|
{{- $attributes := .attributes | default dict }}
|
||||||
|
{{- $otherAttributes := dict }}
|
||||||
|
{{- range $k, $v := $attributes }}
|
||||||
|
{{- if eq $k "align" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $otherAttributes = (dict $k $v) | merge $otherAttributes }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $attributes = $otherAttributes }}
|
||||||
|
|
||||||
|
{{- /* enrich attributes */}}
|
||||||
|
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) "math" slice) " ")) }}
|
||||||
|
{{- $attributes = merge $attributes (dict "class" (delimit (append (index $attributes "class" | default slice) (printf "align-%s" $align) slice) " ")) }}
|
||||||
|
|
||||||
{{- with $page }}
|
{{- with $page }}
|
||||||
<span class="math align-{{ $align }}">
|
<span
|
||||||
{{- $content | safeHTML -}}
|
{{- range $k, $v := $attributes }}
|
||||||
</span>
|
{{- if $v }}
|
||||||
|
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}>{{ $content | safeHTML }}</span>
|
||||||
{{- .Store.Set "hasMathJax" true }}
|
{{- .Store.Set "hasMathJax" true }}
|
||||||
{{- end }}
|
{{- end }}
|
|
@ -1734,6 +1734,10 @@ input[type="search"]::-webkit-search-cancel-button,
|
||||||
input[type="search"]::-webkit-search-results-button,
|
input[type="search"]::-webkit-search-results-button,
|
||||||
input[type="search"]::-webkit-search-results-decoration { display: none; }
|
input[type="search"]::-webkit-search-results-decoration { display: none; }
|
||||||
|
|
||||||
|
span.math:has(> mjx-container[display]) {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
@supports selector(.math:has(> mjx-container)){
|
@supports selector(.math:has(> mjx-container)){
|
||||||
.math{
|
.math{
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
|
@ -1742,7 +1746,6 @@ input[type="search"]::-webkit-search-results-decoration { display: none; }
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.math.align-left > mjx-container{
|
.math.align-left > mjx-container{
|
||||||
text-align: left !important;
|
text-align: left !important;
|
||||||
}
|
}
|
||||||
|
@ -2285,3 +2288,8 @@ html[dir="rtl"] #R-sidebar ul.collapsible-menu > li > label > i.fa-chevron-right
|
||||||
.term-list ul > li ~ li:before {
|
.term-list ul > li ~ li:before {
|
||||||
content: " | "
|
content: " | "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background-color: red !important;
|
||||||
|
border: 5px solid #d000d0 !important;
|
||||||
|
}
|
Loading…
Reference in a new issue