Skip to content

Commit

Permalink
feat: #181
Browse files Browse the repository at this point in the history
完美支持 #181
  • Loading branch information
everfu committed Mar 24, 2024
1 parent 6bbf1ba commit 45375a1
Show file tree
Hide file tree
Showing 11 changed files with 387 additions and 157 deletions.
5 changes: 4 additions & 1 deletion source/css/_global/var.styl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ else if hexo-config('hightlight.theme') == 'mac'
$hl_bg_light = #FFFFFF
$hltools_bg_light = #E7E7E7
$hl_bg_dark = #1C1E1E
$hltools_bg_dark = #2A282A
$hltools_bg_dark = #2A282A

// code
$line-height-code-block = 1.6
File renamed without changes.
187 changes: 38 additions & 149 deletions source/css/_highlight/highlight/index.styl
Original file line number Diff line number Diff line change
@@ -1,156 +1,45 @@
@import "diff"
figure
&:hover
box-shadow var(--efu-shadow-border-hover)

.copy-btn
position absolute
top 1rem
right 1rem
z-index 10
color var(--efu-fontcolor)
cursor pointer
transition all .2s ease 0s

&:hover
color var(--efu-lighttext)

&.highlight
background-color var(--efu-hl-bg)
color var(--efu-fontcolor)
border var(--style-border-always)
overflow hidden
border-radius 8px 8px 4px 4px
position relative
margin .5rem 0 .5rem
padding 0
line-height 1.6

pre
margin 0
padding 8px 0
pre
margin 0
padding 8px 0
border none
table
display block
border none
overflow-y hidden
overflow-x auto

td
padding 0
border none
height 100%

.highlight-tools
position relative
display flex
-webkit-box-align center
align-items center
overflow hidden
min-height 1.2rem
height 2.15em
font-size 16px
background var(--efu-hltools-bg)
border-bottom var(--style-border-always)
color var(--efu-fontcolor)

&.closed
.expand
transition all .3s ease 0s
transform rotate(-90deg)

& ~ *
display none

.st-copy-fill
position absolute
cursor pointer
transition color .2s
font-size 18px

.st-copy-fill:hover
color var(--efu-main)

.expand
position absolute
padding 0.4rem 0.3rem
cursor pointer
transition transform .3s ease 0s

.code-lang
text-transform capitalize
position absolute
font-weight 700
font-size 1.15em
&.gutter
opacity .6
user-select none

.code-expand-btn
background var(--efu-hltools-bg)
transition .3s
backdrop-filter saturate(180%) blur(20px)
transform translateZ(0)
border-top var(--style-border-always)
position absolute
bottom 0
z-index 10
width 100%
text-align center
font-size 16px
cursor pointer
display flex
align-items center
justify-content center
height 32px

i
color var(--efu-fontcolor)
line-height 1
animation 1.2s ease 0s infinite normal none running code-expand-key

&:hover
background var(--efu-main)

i
color var(--efu-white)

&.expand-done
display none

&:not(.expand-done)
& ~ table,
& ~ pre
overflow: hidden
height: unit(hexo-config('highlight.limit'), px)

table
display block
border none
overflow-y hidden
overflow-x auto

td
padding 0
border none
height 100%

&.gutter
opacity .6
user-select none

pre
overflow auto
line-height 1.6
margin 0
padding 8px .5rem
border none
color var(--efu-secondtext)
background var(--efu-secondbg)
border-right var(--style-border-always)
text-align right

&.code
pre
overflow auto
line-height 1.6
margin 0
padding 8px .5rem
border none
color var(--efu-secondtext)
background var(--efu-secondbg)
border-right var(--style-border-always)
text-align right

&.code
width 100%
display flex
position relative

pre
padding-right .5rem
padding-left .5rem
width 100%
display flex
position relative

pre
padding-right .5rem
padding-left .5rem
width 100%

.line
&.marked
background-color: rgba(97, 97, 97, .314)

@import "diff"

@import "theme/" + hexo-config('hightlight.theme')
.line
&.marked
background-color: rgba(97, 97, 97, .314)
113 changes: 111 additions & 2 deletions source/css/_highlight/index.styl
Original file line number Diff line number Diff line change
@@ -1,7 +1,116 @@
@import "theme"
@import "color"

@import "theme/" + hexo-config('highlight.theme')

if $highlight_enable
@require "highlight/index.styl"

if $prismjs_enable
@require "prismjs/index.styl"
@require "prismjs/index.styl"

figure
&:hover
box-shadow var(--efu-shadow-border-hover)

.copy-btn
position absolute
top 1rem
right 1rem
z-index 10
color var(--efu-fontcolor)
cursor pointer
transition all .2s ease 0s

&:hover
color var(--efu-lighttext)

&.highlight
background-color var(--efu-hl-bg)
color var(--efu-fontcolor)
border var(--style-border-always)
overflow hidden
border-radius 8px 8px 4px 4px
position relative
margin .5rem 0 .5rem
padding 0
line-height 1.6

.highlight-tools
position relative
display flex
-webkit-box-align center
align-items center
overflow hidden
min-height 1.2rem
height 2.15em
font-size 16px
background var(--efu-hltools-bg)
border-bottom var(--style-border-always)
color var(--efu-fontcolor)

&.closed
.expand
transition all .3s ease 0s

& ~ *
display none

.st-copy-fill
position absolute
cursor pointer
transition color .2s
font-size 18px

.st-copy-fill:hover
color var(--efu-main)

.expand
position absolute
padding 0.4rem 0.3rem
cursor pointer
transition transform .3s ease 0s

.code-lang
text-transform capitalize
position absolute
font-weight 700
font-size 1.15em
user-select none

.code-expand-btn
background var(--efu-hltools-bg)
transition .3s
backdrop-filter saturate(180%) blur(20px)
transform translateZ(0)
border-top var(--style-border-always)
position absolute
bottom 0
z-index 10
width 100%
text-align center
font-size 16px
cursor pointer
display flex
align-items center
justify-content center
height 32px

i
color var(--efu-fontcolor)
line-height 1
animation 1.2s ease 0s infinite normal none running code-expand-key

&:hover
background var(--efu-main)

i
color var(--efu-white)

&.expand-done
display none

&:not(.expand-done)
& ~ table,
& ~ pre
overflow: hidden
height: unit(hexo-config('highlight.limit'), px)
Loading

0 comments on commit 45375a1

Please sign in to comment.