@vuepress/theme-default 2.0.0-rc.3 → 2.0.0-rc.31
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.
- package/lib/client/components/HomeHero.vue +2 -2
- package/lib/client/components/Navbar.vue +10 -9
- package/lib/client/components/NavbarBrand.vue +3 -2
- package/lib/client/components/NavbarDropdown.vue +4 -5
- package/lib/client/components/NavbarItems.vue +36 -37
- package/lib/client/components/PageMeta.vue +123 -27
- package/lib/client/components/PageNav.vue +133 -27
- package/lib/client/components/SidebarItem.vue +2 -3
- package/lib/client/components/SidebarItems.vue +1 -1
- package/lib/client/composables/index.d.ts +1 -0
- package/lib/client/composables/index.js +1 -0
- package/lib/client/composables/useNavigate.d.ts +1 -0
- package/lib/client/composables/useNavigate.js +25 -0
- package/lib/client/composables/useSidebarItems.d.ts +3 -4
- package/lib/client/composables/useSidebarItems.js +10 -12
- package/lib/client/composables/useUpdateDeviceStatus.js +5 -4
- package/lib/client/config.js +7 -11
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +0 -1
- package/lib/client/layouts/Layout.vue +10 -2
- package/lib/client/layouts/NotFound.vue +2 -2
- package/lib/client/shim.d.ts +3 -3
- package/lib/client/styles/arrow.scss +18 -24
- package/lib/client/styles/code.scss +105 -9
- package/lib/client/styles/custom-container.scss +4 -8
- package/lib/client/styles/external-link-icon.scss +33 -0
- package/lib/client/styles/index.scss +1 -0
- package/lib/client/styles/layout.scss +4 -0
- package/lib/client/styles/navbar-dropdown.scss +2 -2
- package/lib/client/styles/navbar.scss +4 -4
- package/lib/client/styles/normalize.scss +1 -1
- package/lib/client/styles/page.scss +0 -76
- package/lib/client/styles/sidebar.scss +1 -1
- package/lib/client/styles/vars-dark.scss +7 -0
- package/lib/client/styles/vars.scss +69 -14
- package/lib/client/utils/getNavLink.d.ts +3 -9
- package/lib/client/utils/getNavLink.js +10 -11
- package/lib/client/utils/index.d.ts +0 -1
- package/lib/client/utils/index.js +0 -1
- package/lib/client/utils/isActiveSidebarItem.d.ts +1 -1
- package/lib/client/utils/resolveEditLink.d.ts +1 -1
- package/lib/node/defaultTheme.js +31 -23
- package/lib/node/index.d.ts +2 -1
- package/lib/node/index.js +1 -1
- package/lib/node/utils/resolveContainerPluginOptions.d.ts +3 -3
- package/lib/node/utils/resolveContainerPluginOptions.js +2 -2
- package/lib/shared/nav.d.ts +3 -11
- package/lib/shared/options.d.ts +27 -5
- package/lib/shared/page.d.ts +5 -3
- package/package.json +21 -20
- package/templates/build.html +13 -10
- package/lib/client/components/AutoLink.vue +0 -113
- package/lib/client/utils/getResolveRouteWithRedirect.d.ts +0 -5
- package/lib/client/utils/getResolveRouteWithRedirect.js +0 -22
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import SidebarItem from '@theme/SidebarItem.vue'
|
|
3
3
|
import { onMounted, watch } from 'vue'
|
|
4
|
-
import { useRoute } from '
|
|
4
|
+
import { useRoute } from 'vuepress/client'
|
|
5
5
|
import { useSidebarItems } from '../composables/index.js'
|
|
6
6
|
|
|
7
7
|
const route = useRoute()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useNavigate: () => ((url: string) => void);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isLinkAbsolute, isLinkWithProtocol } from '@vuepress/helper/client';
|
|
2
|
+
import { useRoute, useRouter } from 'vuepress/client';
|
|
3
|
+
const FAKE_HOST = 'http://.';
|
|
4
|
+
export const useNavigate = () => {
|
|
5
|
+
const router = useRouter();
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
return (url) => {
|
|
8
|
+
if (url)
|
|
9
|
+
if (isLinkAbsolute(url)) {
|
|
10
|
+
// Inner absolute path
|
|
11
|
+
if (route.path !== url)
|
|
12
|
+
router.push(url);
|
|
13
|
+
}
|
|
14
|
+
else if (isLinkWithProtocol(url)) {
|
|
15
|
+
// Outer url
|
|
16
|
+
if (window)
|
|
17
|
+
window.open(url);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// Inner relative path
|
|
21
|
+
const loc = route.path.slice(0, route.path.lastIndexOf('/'));
|
|
22
|
+
router.push(new URL(`${loc}/${encodeURI(url)}`, FAKE_HOST).pathname);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
-
import type { Router } from 'vue-router';
|
|
3
2
|
import type { PageData, PageHeader } from 'vuepress/client';
|
|
4
3
|
import type { DefaultThemeData, DefaultThemeNormalPageFrontmatter, ResolvedSidebarItem, SidebarConfigArray, SidebarConfigObject } from '../../shared/index.js';
|
|
5
4
|
export type SidebarItemsRef = ComputedRef<ResolvedSidebarItem[]>;
|
|
@@ -17,7 +16,7 @@ export declare const setupSidebarItems: () => void;
|
|
|
17
16
|
*
|
|
18
17
|
* It should only be resolved and provided once
|
|
19
18
|
*/
|
|
20
|
-
export declare const resolveSidebarItems: (frontmatter: DefaultThemeNormalPageFrontmatter, themeLocale: DefaultThemeData, page: PageData,
|
|
19
|
+
export declare const resolveSidebarItems: (frontmatter: DefaultThemeNormalPageFrontmatter, themeLocale: DefaultThemeData, page: PageData, path: string) => ResolvedSidebarItem[];
|
|
21
20
|
/**
|
|
22
21
|
* Util to transform page header to sidebar item
|
|
23
22
|
*/
|
|
@@ -30,8 +29,8 @@ export declare const resolveAutoSidebarItems: (page: PageData, sidebarDepth: num
|
|
|
30
29
|
/**
|
|
31
30
|
* Resolve sidebar items if the config is an array
|
|
32
31
|
*/
|
|
33
|
-
export declare const resolveArraySidebarItems: (page: PageData,
|
|
32
|
+
export declare const resolveArraySidebarItems: (page: PageData, path: string, sidebarConfig: SidebarConfigArray, sidebarDepth: number) => ResolvedSidebarItem[];
|
|
34
33
|
/**
|
|
35
34
|
* Resolve sidebar items if the config is a key -> value (path-prefix -> array) object
|
|
36
35
|
*/
|
|
37
|
-
export declare const resolveMultiSidebarItems: (page: PageData,
|
|
36
|
+
export declare const resolveMultiSidebarItems: (page: PageData, path: string, sidebarConfig: SidebarConfigObject, sidebarDepth: number) => ResolvedSidebarItem[];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { computed, inject, provide } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import { usePageData, usePageFrontmatter } from 'vuepress/client';
|
|
2
|
+
import { usePageData, usePageFrontmatter, useRoute } from 'vuepress/client';
|
|
4
3
|
import { isPlainObject, isString, resolveLocalePath } from 'vuepress/shared';
|
|
5
|
-
import {
|
|
4
|
+
import { getAutoLink } from '../utils/index.js';
|
|
6
5
|
import { useThemeLocaleData } from './useThemeData.js';
|
|
7
6
|
export const sidebarItemsSymbol = Symbol('sidebarItems');
|
|
8
7
|
/**
|
|
@@ -23,8 +22,7 @@ export const setupSidebarItems = () => {
|
|
|
23
22
|
const frontmatter = usePageFrontmatter();
|
|
24
23
|
const page = usePageData();
|
|
25
24
|
const route = useRoute();
|
|
26
|
-
const
|
|
27
|
-
const sidebarItems = computed(() => resolveSidebarItems(frontmatter.value, themeLocale.value, page.value, router, route.path));
|
|
25
|
+
const sidebarItems = computed(() => resolveSidebarItems(frontmatter.value, themeLocale.value, page.value, route.path));
|
|
28
26
|
provide(sidebarItemsSymbol, sidebarItems);
|
|
29
27
|
};
|
|
30
28
|
/**
|
|
@@ -32,7 +30,7 @@ export const setupSidebarItems = () => {
|
|
|
32
30
|
*
|
|
33
31
|
* It should only be resolved and provided once
|
|
34
32
|
*/
|
|
35
|
-
export const resolveSidebarItems = (frontmatter, themeLocale, page,
|
|
33
|
+
export const resolveSidebarItems = (frontmatter, themeLocale, page, path) => {
|
|
36
34
|
// get sidebar config from frontmatter > theme data
|
|
37
35
|
const sidebarConfig = frontmatter.sidebar ?? themeLocale.sidebar ?? 'auto';
|
|
38
36
|
const sidebarDepth = frontmatter.sidebarDepth ?? themeLocale.sidebarDepth ?? 2;
|
|
@@ -44,10 +42,10 @@ export const resolveSidebarItems = (frontmatter, themeLocale, page, router, path
|
|
|
44
42
|
return resolveAutoSidebarItems(page, sidebarDepth);
|
|
45
43
|
}
|
|
46
44
|
if (Array.isArray(sidebarConfig)) {
|
|
47
|
-
return resolveArraySidebarItems(page,
|
|
45
|
+
return resolveArraySidebarItems(page, path, sidebarConfig, sidebarDepth);
|
|
48
46
|
}
|
|
49
47
|
if (isPlainObject(sidebarConfig)) {
|
|
50
|
-
return resolveMultiSidebarItems(page,
|
|
48
|
+
return resolveMultiSidebarItems(page, path, sidebarConfig, sidebarDepth);
|
|
51
49
|
}
|
|
52
50
|
return [];
|
|
53
51
|
};
|
|
@@ -76,11 +74,11 @@ export const resolveAutoSidebarItems = (page, sidebarDepth) => {
|
|
|
76
74
|
/**
|
|
77
75
|
* Resolve sidebar items if the config is an array
|
|
78
76
|
*/
|
|
79
|
-
export const resolveArraySidebarItems = (page,
|
|
77
|
+
export const resolveArraySidebarItems = (page, path, sidebarConfig, sidebarDepth) => {
|
|
80
78
|
const handleChildItem = (item) => {
|
|
81
79
|
let childItem;
|
|
82
80
|
if (isString(item)) {
|
|
83
|
-
childItem =
|
|
81
|
+
childItem = getAutoLink(item);
|
|
84
82
|
}
|
|
85
83
|
else {
|
|
86
84
|
childItem = item;
|
|
@@ -108,11 +106,11 @@ export const resolveArraySidebarItems = (page, router, path, sidebarConfig, side
|
|
|
108
106
|
/**
|
|
109
107
|
* Resolve sidebar items if the config is a key -> value (path-prefix -> array) object
|
|
110
108
|
*/
|
|
111
|
-
export const resolveMultiSidebarItems = (page,
|
|
109
|
+
export const resolveMultiSidebarItems = (page, path, sidebarConfig, sidebarDepth) => {
|
|
112
110
|
const sidebarPath = resolveLocalePath(sidebarConfig, path);
|
|
113
111
|
const matchedSidebarConfig = sidebarConfig[sidebarPath] ?? [];
|
|
114
112
|
if (matchedSidebarConfig === 'heading') {
|
|
115
113
|
return resolveAutoSidebarItems(page, sidebarDepth);
|
|
116
114
|
}
|
|
117
|
-
return resolveArraySidebarItems(page,
|
|
115
|
+
return resolveArraySidebarItems(page, path, matchedSidebarConfig, sidebarDepth);
|
|
118
116
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { useEventListener } from '@vueuse/core';
|
|
1
2
|
import { onMounted } from 'vue';
|
|
2
|
-
import
|
|
3
|
+
import cssVariables from '../styles/_variables.module.scss';
|
|
3
4
|
export var DeviceType;
|
|
4
5
|
(function (DeviceType) {
|
|
5
6
|
DeviceType["MOBILE"] = "mobile";
|
|
6
7
|
})(DeviceType || (DeviceType = {}));
|
|
7
8
|
const DeviceTypeMap = {
|
|
8
|
-
[DeviceType.MOBILE]: Number.parseInt(
|
|
9
|
+
[DeviceType.MOBILE]: Number.parseInt(cssVariables.mobile.replace('px', ''), 10),
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* add listener to detect screen though device type
|
|
@@ -17,9 +18,9 @@ export const useUpdateDeviceStatus = (deviceType, callback) => {
|
|
|
17
18
|
throw new Error('device width must be a integer');
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
21
|
+
useEventListener('orientationchange', () => callback(width), false);
|
|
22
|
+
useEventListener('resize', () => callback(width), false);
|
|
20
23
|
onMounted(() => {
|
|
21
24
|
callback(width);
|
|
22
|
-
window.addEventListener('resize', () => callback(width), false);
|
|
23
|
-
window.addEventListener('orientationchange', () => callback(width), false);
|
|
24
25
|
});
|
|
25
26
|
};
|
package/lib/client/config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasGlobalComponent } from '@vuepress/helper/client';
|
|
1
2
|
import { h } from 'vue';
|
|
2
3
|
import { defineClientConfig } from 'vuepress/client';
|
|
3
4
|
import { Badge, CodeGroup, CodeGroupItem } from './components/global/index.js';
|
|
@@ -7,17 +8,12 @@ import NotFound from './layouts/NotFound.vue';
|
|
|
7
8
|
import './styles/index.scss';
|
|
8
9
|
export default defineClientConfig({
|
|
9
10
|
enhance({ app, router }) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (ExternalLinkIcon) {
|
|
17
|
-
return h(ExternalLinkIcon);
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
});
|
|
11
|
+
if (!hasGlobalComponent('Badge'))
|
|
12
|
+
app.component('Badge', Badge);
|
|
13
|
+
if (!hasGlobalComponent('CodeGroup'))
|
|
14
|
+
app.component('CodeGroup', CodeGroup);
|
|
15
|
+
if (!hasGlobalComponent('CodeGroupItem'))
|
|
16
|
+
app.component('CodeGroupItem', CodeGroupItem);
|
|
21
17
|
// compat with @vuepress/plugin-docsearch and @vuepress/plugin-search
|
|
22
18
|
app.component('NavbarSearch', () => {
|
|
23
19
|
const SearchComponent = app.component('Docsearch') || app.component('SearchBox');
|
package/lib/client/index.d.ts
CHANGED
package/lib/client/index.js
CHANGED
|
@@ -4,8 +4,7 @@ import Navbar from '@theme/Navbar.vue'
|
|
|
4
4
|
import Page from '@theme/Page.vue'
|
|
5
5
|
import Sidebar from '@theme/Sidebar.vue'
|
|
6
6
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
|
7
|
-
import { useRouter } from '
|
|
8
|
-
import { usePageData, usePageFrontmatter } from 'vuepress/client'
|
|
7
|
+
import { usePageData, usePageFrontmatter, useRouter } from 'vuepress/client'
|
|
9
8
|
import type { DefaultThemePageFrontmatter } from '../../shared/index.js'
|
|
10
9
|
import {
|
|
11
10
|
useScrollPromise,
|
|
@@ -60,12 +59,21 @@ const onTouchEnd = (e): void => {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
|
|
62
|
+
// external-link-icon
|
|
63
|
+
const enableExternalLinkIcon = computed(
|
|
64
|
+
() =>
|
|
65
|
+
frontmatter.value.externalLinkIcon ??
|
|
66
|
+
themeLocale.value.externalLinkIcon ??
|
|
67
|
+
true,
|
|
68
|
+
)
|
|
69
|
+
|
|
63
70
|
// classes
|
|
64
71
|
const containerClass = computed(() => [
|
|
65
72
|
{
|
|
66
73
|
'no-navbar': !shouldShowNavbar.value,
|
|
67
74
|
'no-sidebar': !sidebarItems.value.length,
|
|
68
75
|
'sidebar-open': isSidebarOpen.value,
|
|
76
|
+
'external-link-icon': enableExternalLinkIcon.value,
|
|
69
77
|
},
|
|
70
78
|
frontmatter.value.pageClass,
|
|
71
79
|
])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { useRouteLocale } from 'vuepress/client'
|
|
2
|
+
import { RouteLink, useRouteLocale } from 'vuepress/client'
|
|
3
3
|
import { useThemeLocaleData } from '../composables/index.js'
|
|
4
4
|
|
|
5
5
|
const routeLocale = useRouteLocale()
|
|
@@ -20,7 +20,7 @@ const homeText = themeLocale.value.backToHome ?? 'Back to home'
|
|
|
20
20
|
|
|
21
21
|
<blockquote>{{ getMsg() }}</blockquote>
|
|
22
22
|
|
|
23
|
-
<
|
|
23
|
+
<RouteLink :to="homeLink">{{ homeText }}</RouteLink>
|
|
24
24
|
</div>
|
|
25
25
|
</main>
|
|
26
26
|
</div>
|
package/lib/client/shim.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare module '*.vue' {
|
|
|
4
4
|
export default comp
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
declare module '
|
|
8
|
-
const
|
|
9
|
-
export default
|
|
7
|
+
declare module '*/styles/_variables.module.scss' {
|
|
8
|
+
const cSSVariables: Record<string, string>
|
|
9
|
+
export default cSSVariables
|
|
10
10
|
}
|
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
.arrow {
|
|
2
2
|
display: inline-block;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
vertical-align: middle;
|
|
4
|
+
|
|
5
|
+
width: 1em;
|
|
6
|
+
height: 1em;
|
|
7
|
+
|
|
8
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(0,0,0,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");
|
|
9
|
+
background-position: center;
|
|
10
|
+
background-repeat: no-repeat;
|
|
11
|
+
|
|
12
|
+
line-height: normal;
|
|
13
|
+
|
|
14
|
+
transition: all 0.3s;
|
|
15
|
+
|
|
16
|
+
html.dark & {
|
|
17
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z'/%3E%3C/svg%3E");
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
&.down {
|
|
15
|
-
|
|
16
|
-
left: 4px solid transparent;
|
|
17
|
-
right: 4px solid transparent;
|
|
18
|
-
top: 6px solid var(--c-bg-arrow);
|
|
19
|
-
}
|
|
21
|
+
transform: rotate(180deg);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
&.right {
|
|
23
|
-
|
|
24
|
-
top: 4px solid transparent;
|
|
25
|
-
bottom: 4px solid transparent;
|
|
26
|
-
left: 6px solid var(--c-bg-arrow);
|
|
27
|
-
}
|
|
25
|
+
transform: rotate(90deg);
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
&.left {
|
|
31
|
-
|
|
32
|
-
top: 4px solid transparent;
|
|
33
|
-
bottom: 4px solid transparent;
|
|
34
|
-
right: 6px solid var(--c-bg-arrow);
|
|
35
|
-
}
|
|
29
|
+
transform: rotate(-90deg);
|
|
36
30
|
}
|
|
37
31
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
@import '_variables';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
$line-height: 1.375;
|
|
3
|
+
// the original font-size is 14px, 1.7 will make line-height be 23.8px
|
|
4
|
+
$line-height: 1.7;
|
|
6
5
|
|
|
7
6
|
// ===============================
|
|
8
7
|
// Forked and modified from prismjs/themes/prism-tomorrow.css
|
|
@@ -32,7 +31,6 @@ pre[class*='language-'] {
|
|
|
32
31
|
|
|
33
32
|
/* Code blocks */
|
|
34
33
|
pre[class*='language-'] {
|
|
35
|
-
padding: 1em;
|
|
36
34
|
margin: 0.5em 0;
|
|
37
35
|
overflow: auto;
|
|
38
36
|
}
|
|
@@ -129,14 +127,17 @@ pre[class*='language-'] {
|
|
|
129
127
|
pre,
|
|
130
128
|
pre[class*='language-'] {
|
|
131
129
|
line-height: $line-height;
|
|
132
|
-
padding: 1.3rem 1.5rem;
|
|
133
130
|
margin: 0.85rem 0;
|
|
134
131
|
border-radius: 6px;
|
|
135
132
|
overflow: auto;
|
|
136
133
|
|
|
137
134
|
code {
|
|
135
|
+
box-sizing: border-box;
|
|
138
136
|
color: #fff;
|
|
139
|
-
padding:
|
|
137
|
+
padding: 1.3rem 1.5rem;
|
|
138
|
+
display: block;
|
|
139
|
+
width: fit-content;
|
|
140
|
+
min-width: 100%;
|
|
140
141
|
background-color: transparent !important;
|
|
141
142
|
border-radius: 0;
|
|
142
143
|
overflow-wrap: unset;
|
|
@@ -180,6 +181,7 @@ div[class*='language-'] {
|
|
|
180
181
|
top: 0;
|
|
181
182
|
left: 0;
|
|
182
183
|
width: 100%;
|
|
184
|
+
font-size: 0.875em;
|
|
183
185
|
line-height: $line-height;
|
|
184
186
|
|
|
185
187
|
.highlight-line {
|
|
@@ -211,17 +213,21 @@ div[class*='language-'] {
|
|
|
211
213
|
|
|
212
214
|
pre {
|
|
213
215
|
margin-left: var(--code-ln-wrapper-width);
|
|
214
|
-
padding-left: 1rem;
|
|
215
216
|
vertical-align: middle;
|
|
216
217
|
}
|
|
217
218
|
|
|
219
|
+
code {
|
|
220
|
+
padding-left: 1rem;
|
|
221
|
+
}
|
|
222
|
+
|
|
218
223
|
.line-numbers {
|
|
219
224
|
position: absolute;
|
|
220
225
|
top: 0;
|
|
221
226
|
width: var(--code-ln-wrapper-width);
|
|
222
227
|
text-align: center;
|
|
223
228
|
color: var(--code-ln-color);
|
|
224
|
-
padding-top: 1.
|
|
229
|
+
padding-top: 1.3rem;
|
|
230
|
+
font-size: 0.875em;
|
|
225
231
|
line-height: $line-height;
|
|
226
232
|
counter-reset: line-number;
|
|
227
233
|
|
|
@@ -234,7 +240,6 @@ div[class*='language-'] {
|
|
|
234
240
|
&::before {
|
|
235
241
|
counter-increment: line-number;
|
|
236
242
|
content: counter(line-number);
|
|
237
|
-
font-size: 0.85em;
|
|
238
243
|
}
|
|
239
244
|
}
|
|
240
245
|
}
|
|
@@ -252,6 +257,97 @@ div[class*='language-'] {
|
|
|
252
257
|
}
|
|
253
258
|
}
|
|
254
259
|
|
|
260
|
+
// ------------ code notation highlighting ------------
|
|
261
|
+
// matches `<span class="line xxxx" ></span>`
|
|
262
|
+
|
|
263
|
+
div[class*='language-'] pre {
|
|
264
|
+
// highlight lines and notation highlight
|
|
265
|
+
//
|
|
266
|
+
// `!code highlight` and `!code hl` are the same:
|
|
267
|
+
// - `// [\!code highlight]`
|
|
268
|
+
// - `// [\!code hl]`
|
|
269
|
+
// - `// [\!code highlight:3]`
|
|
270
|
+
// - `// [\!code hl:3]`
|
|
271
|
+
//
|
|
272
|
+
// It also has the style of error level,
|
|
273
|
+
// covering the background color with 'warning' and 'error' classes.
|
|
274
|
+
// - `// [\!code warning]`
|
|
275
|
+
// - `// [\!code error]`
|
|
276
|
+
// - `// [\!code warning:3]`
|
|
277
|
+
// - `// [\!code error:3]`
|
|
278
|
+
code .highlighted {
|
|
279
|
+
background-color: var(--code-hl-bg-color);
|
|
280
|
+
transition: background-color 0.5s;
|
|
281
|
+
margin: 0 -24px;
|
|
282
|
+
padding: 0 24px;
|
|
283
|
+
width: 100%;
|
|
284
|
+
display: inline-block;
|
|
285
|
+
|
|
286
|
+
&.error {
|
|
287
|
+
background-color: var(--code-hl-error-bg-color);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
&.warning {
|
|
291
|
+
background-color: var(--code-hl-warning-bg-color);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// notation diff line
|
|
296
|
+
//
|
|
297
|
+
// - class="diff add": `// [\!code ++]` or `// [\!code ++:3]`
|
|
298
|
+
// - class="diff remove": `// [\!code --]` or `// [\!code --:3]`
|
|
299
|
+
code .diff {
|
|
300
|
+
transition: background-color 0.5s;
|
|
301
|
+
margin: 0 -24px;
|
|
302
|
+
padding: 0 24px;
|
|
303
|
+
width: 100%;
|
|
304
|
+
display: inline-block;
|
|
305
|
+
|
|
306
|
+
&::before {
|
|
307
|
+
position: absolute;
|
|
308
|
+
left: 10px;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
&.remove {
|
|
312
|
+
background-color: var(--code-line-diff-remove-color);
|
|
313
|
+
opacity: 0.7;
|
|
314
|
+
|
|
315
|
+
&::before {
|
|
316
|
+
content: '-';
|
|
317
|
+
color: var(--code-line-diff-remove-symbol-color);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
&.add {
|
|
322
|
+
background-color: var(--code-line-diff-add-color);
|
|
323
|
+
|
|
324
|
+
&::before {
|
|
325
|
+
content: '+';
|
|
326
|
+
color: var(--code-line-diff-add-symbol-color);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// notation focused lines
|
|
333
|
+
//
|
|
334
|
+
// - `// [\!code focus]`
|
|
335
|
+
// - `// [\!code focus:3]`
|
|
336
|
+
div[class*='language-'] {
|
|
337
|
+
.has-focused-lines .line:not(.has-focus) {
|
|
338
|
+
filter: blur(0.095rem);
|
|
339
|
+
opacity: 0.7;
|
|
340
|
+
transition:
|
|
341
|
+
filter 0.35s,
|
|
342
|
+
opacity 0.35s;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&:hover .has-focused-lines .line:not(.has-focus) {
|
|
346
|
+
filter: blur(0);
|
|
347
|
+
opacity: 1;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
255
351
|
// narrow mobile
|
|
256
352
|
@media (max-width: $MQMobileNarrow) {
|
|
257
353
|
.theme-default-content {
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
&.warning {
|
|
42
|
+
--external-link-icon-color: var(--c-warning-text-quote);
|
|
43
|
+
|
|
42
44
|
border-color: var(--c-warning);
|
|
43
45
|
background-color: var(--c-warning-bg);
|
|
44
46
|
color: var(--c-warning-text);
|
|
@@ -68,13 +70,11 @@
|
|
|
68
70
|
background-color: var(--c-warning-bg-lighter);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
.external-link-icon {
|
|
73
|
-
--external-link-icon-color: var(--c-warning-text-quote);
|
|
74
|
-
}
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
&.danger {
|
|
76
|
+
--external-link-icon-color: var(--c-danger-text-quote);
|
|
77
|
+
|
|
78
78
|
border-color: var(--c-danger);
|
|
79
79
|
background-color: var(--c-danger-bg);
|
|
80
80
|
color: var(--c-danger-text);
|
|
@@ -104,10 +104,6 @@
|
|
|
104
104
|
background-color: var(--c-danger-bg-lighter);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
.external-link-icon {
|
|
109
|
-
--external-link-icon-color: var(--c-danger-text-quote);
|
|
110
|
-
}
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
&.details {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@mixin external-link-icon {
|
|
2
|
+
&::after {
|
|
3
|
+
content: '';
|
|
4
|
+
display: inline-block;
|
|
5
|
+
margin-top: -1px;
|
|
6
|
+
margin-left: 4px;
|
|
7
|
+
width: 11px;
|
|
8
|
+
height: 11px;
|
|
9
|
+
background: var(--external-link-icon-color);
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
-webkit-mask-image: var(--external-link-icon);
|
|
12
|
+
mask-image: var(--external-link-icon);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.vp-external-link-icon {
|
|
17
|
+
@include external-link-icon;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.external-link-icon {
|
|
21
|
+
.external-link {
|
|
22
|
+
@include external-link-icon;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.theme-default-content {
|
|
26
|
+
a[href*="://"],
|
|
27
|
+
a[target=_blank] {
|
|
28
|
+
&:not(.no-external-link-icon) {
|
|
29
|
+
@include external-link-icon;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
& > a {
|
|
56
56
|
font-weight: inherit;
|
|
57
|
-
&.
|
|
57
|
+
&.route-link-active {
|
|
58
58
|
&::after {
|
|
59
59
|
display: none;
|
|
60
60
|
}
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
color: var(--c-text-accent);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
&.
|
|
87
|
+
&.route-link-active {
|
|
88
88
|
color: var(--c-text-accent);
|
|
89
89
|
|
|
90
90
|
&::after {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
color: inherit;
|
|
77
77
|
|
|
78
78
|
&:hover,
|
|
79
|
-
&.
|
|
79
|
+
&.route-link-active {
|
|
80
80
|
color: var(--c-text);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
|
|
94
94
|
> a {
|
|
95
95
|
&:hover,
|
|
96
|
-
&.
|
|
96
|
+
&.route-link-active {
|
|
97
97
|
margin-bottom: -2px;
|
|
98
98
|
border-bottom: 2px solid var(--c-text-accent);
|
|
99
99
|
}
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
|
|
109
109
|
> a {
|
|
110
110
|
&:hover,
|
|
111
|
-
&.
|
|
111
|
+
&.route-link-active {
|
|
112
112
|
margin-bottom: 0;
|
|
113
113
|
border-bottom: none;
|
|
114
114
|
}
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
|
|
118
118
|
a {
|
|
119
119
|
&:hover,
|
|
120
|
-
&.
|
|
120
|
+
&.route-link-active {
|
|
121
121
|
color: var(--c-text-accent);
|
|
122
122
|
}
|
|
123
123
|
}
|