mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
fix: typeit shortcode and stype
This commit is contained in:
parent
edb5533782
commit
3ca901c60f
4 changed files with 43 additions and 23 deletions
|
@ -305,16 +305,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.typeit {
|
|
||||||
.code {
|
|
||||||
padding: .375rem;
|
|
||||||
font-size: .875rem;
|
|
||||||
font-family: $code-font-family;
|
|
||||||
font-weight: bold;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.version {
|
.version {
|
||||||
height: 1.25em;
|
height: 1.25em;
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
|
@ -325,6 +315,28 @@
|
||||||
@import "../_partial/_single/comment";
|
@import "../_partial/_single/comment";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.typeit {
|
||||||
|
.highlight {
|
||||||
|
padding: .375rem;
|
||||||
|
font-size: .875rem;
|
||||||
|
font-family: $code-font-family;
|
||||||
|
font-weight: bold;
|
||||||
|
word-break: break-all;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
--ti-cursor-font-family: $global-font-family;
|
||||||
|
--ti-cursor-font-size: $global-font-size;
|
||||||
|
--ti-cursor-font-weight: $global-font-weight;
|
||||||
|
--ti-cursor-line-height: $global-line-height;
|
||||||
|
--ti-cursor-color: $global-font-secondary-color;
|
||||||
|
--ti-cursor-margin-left: 0;
|
||||||
|
|
||||||
|
[theme=dark] & {
|
||||||
|
--ti-cursor-color: $global-font-secondary-color-dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.lg-toolbar .lg-icon::after {
|
.lg-toolbar .lg-icon::after {
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ lg-thumbnail.js@1.2.0 https://github.com/sachinchoolur/lg-thumbnail.js
|
||||||
lg-zoom.js@1.2.0 https://github.com/sachinchoolur/lg-zoom.js
|
lg-zoom.js@1.2.0 https://github.com/sachinchoolur/lg-zoom.js
|
||||||
clipboard.js@2.0.11 https://github.com/zenorocha/clipboard.js
|
clipboard.js@2.0.11 https://github.com/zenorocha/clipboard.js
|
||||||
sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js
|
sharer.js@0.4.0 https://github.com/ellisonleao/sharer.js
|
||||||
typeit@7.0.4 https://github.com/alexmacarthur/typeit
|
typeit@8.5.4 https://github.com/alexmacarthur/typeit
|
||||||
katex@0.15.3 https://katex.org/
|
katex@0.15.3 https://katex.org/
|
||||||
mermaid@9.0.1 https://github.com/mermaid-js/mermaid
|
mermaid@9.0.1 https://github.com/mermaid-js/mermaid
|
||||||
echarts@5.3.2 https://echarts.apache.org/
|
echarts@5.3.2 https://echarts.apache.org/
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
{{- $content := trim .Inner "\n" -}}
|
{{- $content := trim .Inner "\n" -}}
|
||||||
{{- $classList := .Get "class" | slice -}}
|
{{- $classList := slice -}}
|
||||||
|
{{- with .Get "class" -}}
|
||||||
|
{{- $classList = $classList | append . -}}
|
||||||
|
{{- end -}}
|
||||||
{{- $tag := .Get "tag" | default "div" -}}
|
{{- $tag := .Get "tag" | default "div" -}}
|
||||||
|
|
||||||
{{- with .Get "code" -}}
|
{{- if .Get "code" -}}
|
||||||
{{- /* highlight code content without line number */ -}}
|
{{- /* highlight code content without line number */ -}}
|
||||||
{{- $content = highlight $content . "linenos=false" -}}
|
{{- $content = highlight $content (.Get "code") "lineNos=false, noClasses=false" -}}
|
||||||
{{- /* delete outer label */ -}}
|
{{- /* delete outer label */ -}}
|
||||||
{{- $content = replaceRE `<div class="highlight"><pre class="chroma"><code[^<>]*>(?s)(.*)</code></pre></div>` "$1" $content -}}
|
{{- $content = replaceRE `.*<code[^<>]*>(?s)(.*)</code>.*` "$1" $content -}}
|
||||||
{{- /* parsing markdown links */ -}}
|
{{- if .Get "code-link" -}}
|
||||||
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=$4>$3</a>$1$5$6" $content -}}
|
{{- /* parsing code links */ -}}
|
||||||
{{- /* replace " " to " " and replace "\n" to "<br />" */ -}}
|
{{- $content = replaceRE `(<span[^<>]*>)([^<>]*)\[([^<>]+)\]\(([^<>]+)\)([^<>]*)(</span>)` "$1$2$6<a href=\"$4\">$3</a>$1$5$6" $content -}}
|
||||||
{{- $content = replaceRE ` ` " " $content | replaceRE `(<\w+) ` "$1 " | replaceRE `\n` "<br />" -}}
|
{{- end -}}
|
||||||
{{- /* fix "<br />" location error which is a bug of Typeit HTML parser */ -}}
|
{{- /* split multiline string */ -}}
|
||||||
{{- $content = replaceRE `<br /></span>` "</span><br />" $content -}}
|
{{- $content = split $content "\n" -}}
|
||||||
{{- $classList = $classList | append "highlight" -}}
|
{{- $classList = $classList | append "highlight" -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $content = $content | .Page.RenderString -}}
|
{{- $content = $content | .Page.RenderString -}}
|
||||||
|
@ -26,6 +29,11 @@
|
||||||
{{- $group = $group | default slice | append $id -}}
|
{{- $group = $group | default slice | append $id -}}
|
||||||
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
|
{{- dict $key $group | merge $typeitMap | .Page.Scratch.SetInMap "this" "typeitMap" -}}
|
||||||
|
|
||||||
|
{{- $attrs := printf `id="%v"` $id -}}
|
||||||
|
{{- with $classList -}}
|
||||||
|
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
<div class="typeit">
|
<div class="typeit">
|
||||||
{{- printf `<%v id="%v" class="%v"></%v>` $tag $id (delimit $classList " ") $tag | safeHTML -}}
|
{{- printf `<%v %v></%v>` $tag $attrs $tag | safeHTML -}}
|
||||||
</div>
|
</div>
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue