@vuepress/theme-default 2.0.0-rc.32 → 2.0.0-rc.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/lib/client/components/VPDarkIcon.vue +8 -0
  2. package/lib/client/components/{DropdownTransition.vue → VPDropdownTransition.vue} +10 -1
  3. package/lib/client/components/VPEditIcon.vue +12 -0
  4. package/lib/client/components/VPHome.vue +38 -0
  5. package/lib/client/components/VPHomeFeatures.vue +68 -0
  6. package/lib/client/components/{HomeFooter.vue → VPHomeFooter.vue} +16 -2
  7. package/lib/client/components/{HomeHero.vue → VPHomeHero.vue} +107 -5
  8. package/lib/client/components/VPLightIcon.vue +28 -0
  9. package/lib/client/components/VPNavbar.vue +127 -0
  10. package/lib/client/components/{NavbarBrand.vue → VPNavbarBrand.vue} +36 -4
  11. package/lib/client/components/VPNavbarDropdown.vue +319 -0
  12. package/lib/client/components/VPNavbarItems.vue +110 -0
  13. package/lib/client/components/VPPage.vue +66 -0
  14. package/lib/client/components/VPPageMeta.vue +132 -0
  15. package/lib/client/components/VPPageNav.vue +118 -0
  16. package/lib/client/components/VPSidebar.vue +112 -0
  17. package/lib/client/components/VPSidebarItem.vue +169 -0
  18. package/lib/client/components/{SidebarItems.vue → VPSidebarItems.vue} +30 -6
  19. package/lib/client/components/VPToggleColorModeButton.vue +54 -0
  20. package/lib/client/components/VPToggleSidebarButton.vue +92 -0
  21. package/lib/client/components/global/Badge.vue +60 -18
  22. package/lib/client/components/global/CodeGroup.d.ts +1 -0
  23. package/lib/client/components/global/CodeGroup.js +4 -3
  24. package/lib/client/components/global/CodeGroupItem.vue +5 -16
  25. package/lib/client/composables/index.d.ts +7 -0
  26. package/lib/client/composables/index.js +7 -0
  27. package/lib/client/composables/useContributors.d.ts +3 -0
  28. package/lib/client/composables/useContributors.js +14 -0
  29. package/lib/client/composables/useDarkMode.js +1 -1
  30. package/lib/client/composables/useEditLink.d.ts +3 -0
  31. package/lib/client/composables/useEditLink.js +31 -0
  32. package/lib/client/composables/useLastUpdated.d.ts +2 -0
  33. package/lib/client/composables/useLastUpdated.js +17 -0
  34. package/lib/client/composables/useNavbarConfig.d.ts +3 -0
  35. package/lib/client/composables/useNavbarConfig.js +25 -0
  36. package/lib/client/composables/useNavbarRepo.d.ts +6 -0
  37. package/lib/client/composables/useNavbarRepo.js +38 -0
  38. package/lib/client/composables/useNavbarSelectLanguage.d.ts +6 -0
  39. package/lib/client/composables/useNavbarSelectLanguage.js +58 -0
  40. package/lib/client/composables/useNavigate.js +4 -7
  41. package/lib/client/composables/useRelatedLinks.d.ts +8 -0
  42. package/lib/client/composables/useRelatedLinks.js +73 -0
  43. package/lib/client/composables/useSidebarItems.d.ts +10 -9
  44. package/lib/client/composables/useSidebarItems.js +58 -47
  45. package/lib/client/config.d.ts +1 -0
  46. package/lib/client/config.js +2 -1
  47. package/lib/client/index.d.ts +1 -0
  48. package/lib/client/index.js +1 -0
  49. package/lib/client/layouts/Layout.vue +111 -18
  50. package/lib/client/layouts/NotFound.vue +1 -1
  51. package/lib/client/styles/_mixins.scss +4 -4
  52. package/lib/client/styles/_variables.module.scss +1 -1
  53. package/lib/client/styles/_variables.scss +1 -0
  54. package/lib/client/styles/code-group.scss +32 -29
  55. package/lib/client/styles/{code.scss → content/code.scss} +81 -99
  56. package/lib/client/styles/{custom-container.scss → content/custom-container.scss} +9 -5
  57. package/lib/client/styles/content/index.scss +4 -0
  58. package/lib/client/styles/content/normalize.scss +39 -0
  59. package/lib/client/styles/{toc.scss → content/toc.scss} +1 -1
  60. package/lib/client/styles/external-link-icon.scss +7 -3
  61. package/lib/client/styles/index.scss +2 -13
  62. package/lib/client/styles/layout.scss +3 -203
  63. package/lib/client/styles/normalize.scss +18 -149
  64. package/lib/client/styles/plugins.scss +20 -0
  65. package/lib/client/styles/vars-dark.scss +17 -16
  66. package/lib/client/styles/vars.scss +19 -23
  67. package/lib/client/typings.d.ts +13 -0
  68. package/lib/client/typings.js +1 -0
  69. package/lib/client/utils/{getNavLink.d.ts → getAutoLink.d.ts} +2 -2
  70. package/lib/client/utils/index.d.ts +3 -1
  71. package/lib/client/utils/index.js +3 -1
  72. package/lib/client/utils/isActiveSidebarItem.d.ts +2 -2
  73. package/lib/client/utils/isActiveSidebarItem.js +3 -3
  74. package/lib/client/utils/isLinkInternal.d.ts +1 -0
  75. package/lib/client/utils/isLinkInternal.js +2 -0
  76. package/lib/client/utils/resolvePrefix.d.ts +1 -0
  77. package/lib/client/utils/resolvePrefix.js +4 -0
  78. package/lib/node/defaultTheme.js +9 -1
  79. package/lib/node/utils/assignDefaultLocaleOptions.js +1 -1
  80. package/lib/shared/index.d.ts +2 -0
  81. package/lib/shared/index.js +2 -0
  82. package/lib/shared/nav.d.ts +23 -26
  83. package/lib/shared/navbar.d.ts +21 -0
  84. package/lib/shared/navbar.js +1 -0
  85. package/lib/shared/options.d.ts +4 -3
  86. package/lib/shared/page.d.ts +2 -2
  87. package/lib/shared/sidebar.d.ts +26 -0
  88. package/lib/shared/sidebar.js +1 -0
  89. package/package.json +19 -19
  90. package/templates/build.html +2 -0
  91. package/lib/client/components/Home.vue +0 -15
  92. package/lib/client/components/HomeContent.vue +0 -5
  93. package/lib/client/components/HomeFeatures.vue +0 -22
  94. package/lib/client/components/Navbar.vue +0 -80
  95. package/lib/client/components/NavbarDropdown.vue +0 -125
  96. package/lib/client/components/NavbarItems.vue +0 -198
  97. package/lib/client/components/Page.vue +0 -31
  98. package/lib/client/components/PageMeta.vue +0 -220
  99. package/lib/client/components/PageNav.vue +0 -228
  100. package/lib/client/components/Sidebar.vue +0 -18
  101. package/lib/client/components/SidebarItem.vue +0 -86
  102. package/lib/client/components/ToggleColorModeButton.vue +0 -57
  103. package/lib/client/components/ToggleSidebarButton.vue +0 -24
  104. package/lib/client/styles/badge.scss +0 -36
  105. package/lib/client/styles/home.scss +0 -168
  106. package/lib/client/styles/navbar-dropdown.scss +0 -183
  107. package/lib/client/styles/navbar.scss +0 -197
  108. package/lib/client/styles/page.scss +0 -11
  109. package/lib/client/styles/sidebar.scss +0 -134
  110. package/lib/client/styles/transitions.scss +0 -22
  111. /package/lib/client/utils/{getNavLink.js → getAutoLink.js} +0 -0
@@ -5,6 +5,7 @@ import { Badge, CodeGroup, CodeGroupItem } from './components/global/index.js';
5
5
  import { setupDarkMode, setupSidebarItems, useScrollPromise, } from './composables/index.js';
6
6
  import Layout from './layouts/Layout.vue';
7
7
  import NotFound from './layouts/NotFound.vue';
8
+ import '@vuepress/helper/normalize.css';
8
9
  import './styles/index.scss';
9
10
  export default defineClientConfig({
10
11
  enhance({ app, router }) {
@@ -15,7 +16,7 @@ export default defineClientConfig({
15
16
  if (!hasGlobalComponent('CodeGroupItem'))
16
17
  app.component('CodeGroupItem', CodeGroupItem);
17
18
  // compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
18
- app.component('NavbarSearch', () => {
19
+ app.component('VPSearch', () => {
19
20
  const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
20
21
  if (SearchComponent) {
21
22
  return h(SearchComponent);
@@ -1,3 +1,4 @@
1
1
  export * from './composables/index.js';
2
+ export * from './typings.js';
2
3
  export * from './utils/index.js';
3
4
  export type * from '../shared/index.js';
@@ -1,2 +1,3 @@
1
1
  export * from './composables/index.js';
2
+ export * from './typings.js';
2
3
  export * from './utils/index.js';
@@ -1,16 +1,14 @@
1
1
  <script setup lang="ts">
2
- import Home from '@theme/Home.vue'
3
- import Navbar from '@theme/Navbar.vue'
4
- import Page from '@theme/Page.vue'
5
- import Sidebar from '@theme/Sidebar.vue'
2
+ import { useScrollPromise } from '@theme/useScrollPromise'
3
+ import { useSidebarItems } from '@theme/useSidebarItems'
4
+ import { useThemeLocaleData } from '@theme/useThemeData'
5
+ import VPHome from '@theme/VPHome.vue'
6
+ import VPNavbar from '@theme/VPNavbar.vue'
7
+ import VPPage from '@theme/VPPage.vue'
8
+ import VPSidebar from '@theme/VPSidebar.vue'
6
9
  import { computed, onMounted, onUnmounted, ref } from 'vue'
7
10
  import { usePageData, usePageFrontmatter, useRouter } from 'vuepress/client'
8
11
  import type { DefaultThemePageFrontmatter } from '../../shared/index.js'
9
- import {
10
- useScrollPromise,
11
- useSidebarItems,
12
- useThemeLocaleData,
13
- } from '../composables/index.js'
14
12
 
15
13
  defineSlots<{
16
14
  'navbar'?: (props: Record<never, never>) => any
@@ -98,37 +96,37 @@ const onBeforeLeave = scrollPromise.pending
98
96
 
99
97
  <template>
100
98
  <div
101
- class="theme-container"
99
+ class="vp-theme-container"
102
100
  :class="containerClass"
103
101
  @touchstart="onTouchStart"
104
102
  @touchend="onTouchEnd"
105
103
  >
106
104
  <slot name="navbar">
107
- <Navbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar">
105
+ <VPNavbar v-if="shouldShowNavbar" @toggle-sidebar="toggleSidebar">
108
106
  <template #before>
109
107
  <slot name="navbar-before" />
110
108
  </template>
111
109
  <template #after>
112
110
  <slot name="navbar-after" />
113
111
  </template>
114
- </Navbar>
112
+ </VPNavbar>
115
113
  </slot>
116
114
 
117
- <div class="sidebar-mask" @click="toggleSidebar(false)" />
115
+ <div class="vp-sidebar-mask" @click="toggleSidebar(false)" />
118
116
 
119
117
  <slot name="sidebar">
120
- <Sidebar>
118
+ <VPSidebar>
121
119
  <template #top>
122
120
  <slot name="sidebar-top" />
123
121
  </template>
124
122
  <template #bottom>
125
123
  <slot name="sidebar-bottom" />
126
124
  </template>
127
- </Sidebar>
125
+ </VPSidebar>
128
126
  </slot>
129
127
 
130
128
  <slot name="page">
131
- <Home v-if="frontmatter.home" />
129
+ <VPHome v-if="frontmatter.home" />
132
130
 
133
131
  <Transition
134
132
  v-else
@@ -137,7 +135,7 @@ const onBeforeLeave = scrollPromise.pending
137
135
  @before-enter="onBeforeEnter"
138
136
  @before-leave="onBeforeLeave"
139
137
  >
140
- <Page :key="page.path">
138
+ <VPPage :key="page.path">
141
139
  <template #top>
142
140
  <slot name="page-top" />
143
141
  </template>
@@ -150,8 +148,103 @@ const onBeforeLeave = scrollPromise.pending
150
148
  <template #bottom>
151
149
  <slot name="page-bottom" />
152
150
  </template>
153
- </Page>
151
+ </VPPage>
154
152
  </Transition>
155
153
  </slot>
156
154
  </div>
157
155
  </template>
156
+
157
+ <style lang="scss">
158
+ @import '../styles/variables';
159
+
160
+ .vp-sidebar-mask {
161
+ position: fixed;
162
+ top: 0;
163
+ left: 0;
164
+ z-index: 9;
165
+
166
+ display: none;
167
+
168
+ width: 100vw;
169
+ height: 100vh;
170
+ }
171
+
172
+ .vp-theme-container {
173
+ // navbar is disabled
174
+ &.no-navbar {
175
+ .vp-sidebar {
176
+ top: 0;
177
+
178
+ @media (max-width: $MQMobile) {
179
+ padding-top: 0;
180
+ }
181
+ }
182
+
183
+ .vp-page {
184
+ padding-top: 0;
185
+ }
186
+
187
+ // adjust heading margin and padding;
188
+ .theme-default-content {
189
+ h1,
190
+ h2,
191
+ h3,
192
+ h4,
193
+ h5,
194
+ h6 {
195
+ margin-top: 1.5rem;
196
+ padding-top: 0;
197
+ }
198
+ }
199
+ }
200
+
201
+ &.no-sidebar {
202
+ // hide sidebar
203
+ .vp-sidebar {
204
+ display: none;
205
+
206
+ // show sidebar on mobile because it has navbar links
207
+ @media (max-width: $MQMobile) {
208
+ display: block;
209
+ }
210
+ }
211
+
212
+ .vp-page {
213
+ padding-left: 0;
214
+ }
215
+ }
216
+
217
+ &.sidebar-open {
218
+ @media (max-width: $MQMobile) {
219
+ // show sidebar
220
+ .vp-sidebar {
221
+ transform: translateX(0);
222
+ }
223
+
224
+ // show sidebar mask
225
+ .vp-sidebar-mask {
226
+ display: block;
227
+ }
228
+ }
229
+ }
230
+ }
231
+
232
+ /**
233
+ * fade-slide-y transition
234
+ */
235
+ .fade-slide-y {
236
+ &-enter-active {
237
+ transition: all 0.2s ease;
238
+ }
239
+
240
+ &-leave-active {
241
+ transition: all 0.2s cubic-bezier(1, 0.5, 0.8, 1);
242
+ }
243
+
244
+ &-enter-from,
245
+ &-leave-to {
246
+ opacity: 0;
247
+ transform: translateY(10px);
248
+ }
249
+ }
250
+ </style>
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
+ import { useThemeLocaleData } from '@theme/useThemeData'
2
3
  import { RouteLink, useRouteLocale } from 'vuepress/client'
3
- import { useThemeLocaleData } from '../composables/index.js'
4
4
 
5
5
  const routeLocale = useRouteLocale()
6
6
  const themeLocale = useThemeLocaleData()
@@ -1,6 +1,6 @@
1
- @import '_variables';
1
+ @import 'variables';
2
2
 
3
- @mixin content_wrapper {
3
+ @mixin content-wrapper {
4
4
  max-width: var(--content-width);
5
5
  margin: 0 auto;
6
6
  padding: 2rem 2.5rem;
@@ -14,7 +14,7 @@
14
14
  }
15
15
  }
16
16
 
17
- @mixin dropdown_wrapper {
18
- transition: height 0.1s ease-out;
17
+ @mixin dropdown-wrapper {
19
18
  overflow: hidden;
19
+ transition: height 0.1s ease-out;
20
20
  }
@@ -1,4 +1,4 @@
1
- @import '_variables';
1
+ @import 'variables';
2
2
 
3
3
  :export {
4
4
  mobile: $MQMobile;
@@ -1,3 +1,4 @@
1
+ /* stylelint-disable scss/dollar-variable-pattern */
1
2
  @import '@vuepress/plugin-palette/palette';
2
3
 
3
4
  // responsive breakpoints
@@ -1,48 +1,51 @@
1
- @import '_variables';
1
+ @import 'variables';
2
2
 
3
3
  /**
4
4
  * code-group
5
5
  */
6
- .code-group__nav {
6
+ .code-group-nav {
7
7
  margin-top: 0.85rem;
8
+
8
9
  // 2 * margin + border-radius of <pre> tag
9
10
  margin-bottom: calc(-1.7rem - 6px);
11
+ padding-top: 10px;
10
12
  padding-bottom: calc(1.7rem - 6px);
11
13
  padding-left: 10px;
12
- padding-top: 10px;
13
14
  border-top-left-radius: 6px;
14
15
  border-top-right-radius: 6px;
16
+
15
17
  background-color: var(--c-code-group-tab-bg);
18
+
19
+ @media (max-width: $MQMobileNarrow) {
20
+ margin-right: -1.5rem;
21
+ margin-left: -1.5rem;
22
+ border-radius: 0;
23
+ }
16
24
  }
17
25
 
18
- .code-group__nav-tab {
19
- border: 0;
26
+ .code-group-nav-tab {
20
27
  padding: 5px;
21
- cursor: pointer;
28
+ border: 0;
29
+
22
30
  background-color: transparent;
23
- font-size: 0.85em;
24
- line-height: 1.4;
25
31
  color: var(--c-code-group-tab-title);
32
+
26
33
  font-weight: 600;
27
- }
34
+ font-size: 0.85em;
35
+ line-height: 1.4;
28
36
 
29
- .code-group__nav-tab:focus {
30
- outline: none;
31
- }
37
+ cursor: pointer;
32
38
 
33
- .code-group__nav-tab:focus-visible {
34
- outline: 1px solid var(--c-code-group-tab-outline);
35
- }
39
+ &:focus {
40
+ outline: none;
41
+ }
36
42
 
37
- .code-group__nav-tab-active {
38
- border-bottom: var(--c-code-group-tab-active-border) 1px solid;
39
- }
43
+ &:focus-visible {
44
+ outline: 1px solid var(--c-code-group-tab-outline);
45
+ }
40
46
 
41
- @media (max-width: $MQMobileNarrow) {
42
- .code-group__nav {
43
- margin-left: -1.5rem;
44
- margin-right: -1.5rem;
45
- border-radius: 0;
47
+ &.active {
48
+ border-bottom: var(--c-code-group-tab-active-border) 1px solid;
46
49
  }
47
50
  }
48
51
 
@@ -51,12 +54,12 @@
51
54
  */
52
55
  .code-group-item {
53
56
  display: none;
54
- }
55
57
 
56
- .code-group-item__active {
57
- display: block;
58
- }
58
+ &.active {
59
+ display: block;
60
+ }
59
61
 
60
- .code-group-item > pre {
61
- background-color: orange;
62
+ > pre {
63
+ background-color: #ffa500;
64
+ }
62
65
  }
@@ -1,50 +1,26 @@
1
- @import '_variables';
1
+ /* stylelint-disable no-duplicate-selectors */
2
+ /* stylelint-disable scss/comment-no-empty */
3
+ @import '../variables';
2
4
 
3
5
  // the original font-size is 14px, 1.7 will make line-height be 23.8px
4
6
  $line-height: 1.7;
5
7
 
6
- // ===============================
7
- // Forked and modified from prismjs/themes/prism-tomorrow.css
8
-
9
- code[class*='language-'],
10
8
  pre[class*='language-'] {
11
- color: #ccc;
12
- background: none;
13
- font-family: var(--font-family-code);
14
- font-size: 1em;
15
- text-align: left;
16
- white-space: pre;
17
- word-spacing: normal;
18
- word-break: normal;
19
- word-wrap: normal;
20
- line-height: 1.5;
9
+ overflow: auto;
21
10
 
22
- -moz-tab-size: 4;
23
- -o-tab-size: 4;
24
- tab-size: 4;
11
+ margin: 0.5em 0;
25
12
 
26
- -webkit-hyphens: none;
27
- -moz-hyphens: none;
28
- -ms-hyphens: none;
29
- hyphens: none;
13
+ font-size: 1em;
14
+ font-family: var(--font-family-code);
15
+ line-height: 1.5;
30
16
  }
31
17
 
32
- /* Code blocks */
33
- pre[class*='language-'] {
34
- margin: 0.5em 0;
35
- overflow: auto;
36
- }
18
+ // ===============================
19
+ // Forked and modified from prismjs/themes/prism-tomorrow.css
37
20
 
38
- :not(pre) > code[class*='language-'],
39
21
  pre[class*='language-'] {
40
22
  background: #2d2d2d;
41
- }
42
-
43
- /* Inline code */
44
- :not(pre) > code[class*='language-'] {
45
- padding: 0.1em;
46
- border-radius: 0.3em;
47
- white-space: normal;
23
+ color: #ccc;
48
24
  }
49
25
 
50
26
  .token.comment,
@@ -109,6 +85,7 @@ pre[class*='language-'] {
109
85
  .token.bold {
110
86
  font-weight: bold;
111
87
  }
88
+
112
89
  .token.italic {
113
90
  font-style: italic;
114
91
  }
@@ -126,21 +103,26 @@ pre[class*='language-'] {
126
103
  .theme-default-content {
127
104
  pre,
128
105
  pre[class*='language-'] {
129
- line-height: $line-height;
106
+ overflow: auto;
130
107
  margin: 0.85rem 0;
131
108
  border-radius: 6px;
132
- overflow: auto;
109
+ line-height: $line-height;
133
110
 
134
111
  code {
135
- box-sizing: border-box;
136
- color: #fff;
137
- padding: 1.3rem 1.5rem;
138
112
  display: block;
113
+
114
+ box-sizing: border-box;
115
+
139
116
  width: fit-content;
140
117
  min-width: 100%;
141
- background-color: transparent !important;
118
+ padding: 1.3rem 1.5rem;
142
119
  border-radius: 0;
120
+
121
+ background-color: transparent !important;
122
+ color: #fff;
123
+
143
124
  overflow-wrap: unset;
125
+
144
126
  -webkit-font-smoothing: auto;
145
127
  -moz-osx-font-smoothing: auto;
146
128
  }
@@ -153,40 +135,29 @@ pre[class*='language-'] {
153
135
 
154
136
  div[class*='language-'] {
155
137
  position: relative;
156
- background-color: var(--code-bg-color);
157
138
  border-radius: 6px;
139
+ background-color: var(--code-bg-color);
158
140
 
159
141
  &::before {
160
142
  content: attr(data-title);
143
+
161
144
  position: absolute;
162
- z-index: 3;
163
145
  top: 0.8em;
164
146
  right: 1em;
165
- font-size: 0.75rem;
147
+ z-index: 3;
148
+
166
149
  color: var(--code-ln-color);
150
+
151
+ font-size: 0.75rem;
167
152
  }
168
153
 
169
154
  pre,
170
155
  pre[class*='language-'] {
171
- // force override the background color to be compatible with shiki
172
- background: transparent !important;
173
156
  position: relative;
174
157
  z-index: 1;
175
- }
176
158
 
177
- .highlight-lines {
178
- user-select: none;
179
- padding-top: 1.3rem;
180
- position: absolute;
181
- top: 0;
182
- left: 0;
183
- width: 100%;
184
- font-size: 0.875em;
185
- line-height: $line-height;
186
-
187
- .highlight-line {
188
- background-color: var(--code-hl-bg-color);
189
- }
159
+ // force override the background color to be compatible with shiki
160
+ background: transparent !important;
190
161
  }
191
162
 
192
163
  &:not(.line-numbers-mode) {
@@ -196,24 +167,9 @@ div[class*='language-'] {
196
167
  }
197
168
 
198
169
  &.line-numbers-mode {
199
- .highlight-lines .highlight-line {
200
- position: relative;
201
-
202
- &::before {
203
- content: ' ';
204
- position: absolute;
205
- z-index: 2;
206
- left: 0;
207
- top: 0;
208
- display: block;
209
- width: var(--code-ln-wrapper-width);
210
- height: 100%;
211
- }
212
- }
213
-
214
170
  pre {
215
- margin-left: var(--code-ln-wrapper-width);
216
171
  vertical-align: middle;
172
+ margin-left: var(--code-ln-wrapper-width);
217
173
  }
218
174
 
219
175
  code {
@@ -223,44 +179,67 @@ div[class*='language-'] {
223
179
  .line-numbers {
224
180
  position: absolute;
225
181
  top: 0;
182
+
226
183
  width: var(--code-ln-wrapper-width);
227
- text-align: center;
228
- color: var(--code-ln-color);
229
184
  padding-top: 1.3rem;
185
+
186
+ color: var(--code-ln-color);
187
+
230
188
  font-size: 0.875em;
231
189
  line-height: $line-height;
232
190
  counter-reset: line-number;
191
+ text-align: center;
233
192
 
234
193
  .line-number {
235
194
  position: relative;
236
195
  z-index: 3;
237
196
  user-select: none;
238
- height: #{$line-height}em;
239
197
 
198
+ /* stylelint-disable-next-line max-nesting-depth */
240
199
  &::before {
241
- counter-increment: line-number;
242
200
  content: counter(line-number);
201
+ counter-increment: line-number;
243
202
  }
244
203
  }
245
204
  }
246
205
 
247
206
  &::after {
248
207
  content: '';
208
+
249
209
  position: absolute;
250
210
  top: 0;
251
211
  left: 0;
212
+
252
213
  width: var(--code-ln-wrapper-width);
253
214
  height: 100%;
254
- border-radius: 6px 0 0 6px;
255
215
  border-right: 1px solid var(--code-hl-bg-color);
216
+ border-radius: 6px 0 0 6px;
256
217
  }
257
218
  }
258
219
  }
259
220
 
221
+ // ------------ plugin-shiki code highlighting ------------
222
+ div[data-highlighter='shiki'] {
223
+ background-color: var(--shiki-light-bg, var(--code-bg-color));
224
+ transition: background-color var(--t-color);
225
+
226
+ .dark & {
227
+ background-color: var(--shiki-dark-bg, var(--code-bg-color));
228
+ }
229
+ }
230
+
231
+ .shiki span {
232
+ color: var(--shiki-light, inherit);
233
+
234
+ .dark & {
235
+ color: var(--shiki-dark, inherit);
236
+ }
237
+ }
238
+
260
239
  // ------------ code notation highlighting ------------
261
240
  // matches `<span class="line xxxx" ></span>`
262
241
 
263
- div[class*='language-'] pre {
242
+ div[class*='language-'] {
264
243
  // highlight lines and notation highlight
265
244
  //
266
245
  // `!code highlight` and `!code hl` are the same:
@@ -275,13 +254,16 @@ div[class*='language-'] pre {
275
254
  // - `// [\!code error]`
276
255
  // - `// [\!code warning:3]`
277
256
  // - `// [\!code error:3]`
278
- code .highlighted {
279
- background-color: var(--code-hl-bg-color);
280
- transition: background-color 0.5s;
257
+ .line.highlighted {
258
+ display: inline-block;
259
+
260
+ width: 100%;
281
261
  margin: 0 -24px;
282
262
  padding: 0 24px;
283
- width: 100%;
284
- display: inline-block;
263
+
264
+ background-color: var(--code-hl-bg-color);
265
+
266
+ transition: background-color 0.5s;
285
267
 
286
268
  &.error {
287
269
  background-color: var(--code-hl-error-bg-color);
@@ -296,12 +278,14 @@ div[class*='language-'] pre {
296
278
  //
297
279
  // - class="diff add": `// [\!code ++]` or `// [\!code ++:3]`
298
280
  // - class="diff remove": `// [\!code --]` or `// [\!code --:3]`
299
- code .diff {
300
- transition: background-color 0.5s;
281
+ .line.diff {
282
+ display: inline-block;
283
+
284
+ width: 100%;
301
285
  margin: 0 -24px;
302
286
  padding: 0 24px;
303
- width: 100%;
304
- display: inline-block;
287
+
288
+ transition: background-color 0.5s;
305
289
 
306
290
  &::before {
307
291
  position: absolute;
@@ -327,24 +311,22 @@ div[class*='language-'] pre {
327
311
  }
328
312
  }
329
313
  }
330
- }
331
314
 
332
- // notation focused lines
333
- //
334
- // - `// [\!code focus]`
335
- // - `// [\!code focus:3]`
336
- div[class*='language-'] {
315
+ // notation focused lines
316
+ //
317
+ // - `// [\!code focus]`
318
+ // - `// [\!code focus:3]`
337
319
  .has-focused-lines .line:not(.has-focus) {
338
- filter: blur(0.095rem);
339
320
  opacity: 0.7;
321
+ filter: blur(0.095rem);
340
322
  transition:
341
323
  filter 0.35s,
342
324
  opacity 0.35s;
343
325
  }
344
326
 
345
327
  &:hover .has-focused-lines .line:not(.has-focus) {
346
- filter: blur(0);
347
328
  opacity: 1;
329
+ filter: blur(0);
348
330
  }
349
331
  }
350
332