Merge branch 'main' into last-updated-robust

pull/2149/head
Divyansh Singh 3 years ago committed by GitHub
commit 8d3439bae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,15 +25,6 @@ export default defineConfig({
]
],
transformHead({ page }) {
if (page === 'index.md') {
return [
['link', { rel: 'preload', as: 'image', href: '/vue.svg' }],
['link', { rel: 'preload', as: 'image', href: '/vite.svg' }]
]
}
},
themeConfig: {
nav: nav(),

@ -193,3 +193,13 @@ export default defineLoader({
}
})
```
## Configuration
To get the configuration information inside a loader, you can use some code like this:
```ts
import type { SiteConfig } from 'vitepress'
const config: SiteConfig = (globalThis as any).VITEPRESS_CONFIG
```

@ -160,6 +160,8 @@ export default {
Full list of slots available in the default theme layout:
- When `layout: 'doc'` (default) is enabled via frontmatter:
- `doc-top`
- `doc-bottom`
- `doc-footer-before`
- `doc-before`
- `doc-after`
@ -178,6 +180,9 @@ Full list of slots available in the default theme layout:
- `home-hero-after`
- `home-features-before`
- `home-features-after`
- When `layout: 'page'` is enabled via frontmatter:
- `page-top`
- `page-bottom`
- On not found (404) page:
- `not-found`
- Always:

@ -20,18 +20,12 @@ features:
- icon: 📝
title: Focus on Your Content
details: Effortlessly create beautiful documentation sites with just markdown.
- icon:
src: vite.svg
width: 10
height: 10
- icon: <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><g fill="none"><path fill="url(#a)" d="m29.884 6.146-13.142 23.5a.714.714 0 0 1-1.244.005L2.096 6.148a.714.714 0 0 1 .746-1.057l13.156 2.352a.714.714 0 0 0 .253 0l12.881-2.348a.714.714 0 0 1 .752 1.05z"/><path fill="url(#b)" d="M22.264 2.007 12.54 3.912a.357.357 0 0 0-.288.33l-.598 10.104a.357.357 0 0 0 .437.369l2.707-.625a.357.357 0 0 1 .43.42l-.804 3.939a.357.357 0 0 0 .454.413l1.672-.508a.357.357 0 0 1 .454.414l-1.279 6.187c-.08.387.435.598.65.267l.143-.222 7.925-15.815a.357.357 0 0 0-.387-.51l-2.787.537a.357.357 0 0 1-.41-.45l1.818-6.306a.357.357 0 0 0-.412-.45z"/><defs><linearGradient id="a" x1="6" x2="235" y1="33" y2="344" gradientTransform="translate(1.34 1.894) scale(.07142)" gradientUnits="userSpaceOnUse"><stop stop-color="#41D1FF"/><stop offset="1" stop-color="#BD34FE"/></linearGradient><linearGradient id="b" x1="194.651" x2="236.076" y1="8.818" y2="292.989" gradientTransform="translate(1.34 1.894) scale(.07142)" gradientUnits="userSpaceOnUse"><stop stop-color="#FFEA83"/><stop offset=".083" stop-color="#FFDD35"/><stop offset="1" stop-color="#FFA800"/></linearGradient></defs></g></svg>
title: Enjoy the Vite DX
details: Instant server start, lightning fast hot updates, and leverage Vite ecosystem plugins.
- icon:
src: vue.svg
width: 10
height: 10
- icon: <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#41b883" d="M24.4 3.925H30l-14 24.15L2 3.925h10.71l3.29 5.6 3.22-5.6Z"/><path fill="#41b883" d="m2 3.925 14 24.15 14-24.15h-5.6L16 18.415 7.53 3.925Z"/><path fill="#35495e" d="M7.53 3.925 16 18.485l8.4-14.56h-5.18L16 9.525l-3.29-5.6Z"/></svg>
title: Customize with Vue
details: Use Vue syntax and components directly in markdown, or build custom themes with Vue components.
details: Use Vue syntax and components directly in markdown, or build custom themes with Vue.
- icon: 🚀
title: Ship Fast Sites
details: Fast initial load with static HTML, fast post-load navigation with client-side routing.

@ -1,15 +0,0 @@
<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
<defs>
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
<stop stop-color="#41D1FF"/>
<stop offset="1" stop-color="#BD34FE"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFEA83"/>
<stop offset="0.0833333" stop-color="#FFDD35"/>
<stop offset="1" stop-color="#FFA800"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 196.32 170.02">
<path fill="#42b883" d="M120.83 0L98.16 39.26 75.49 0H0l98.16 170.02L196.32 0h-75.49z"/>
<path fill="#35495e" d="M120.83 0L98.16 39.26 75.49 0H39.26l58.9 102.01L157.06 0h-36.23z"/>
</svg>

Before

Width:  |  Height:  |  Size: 261 B

@ -166,11 +166,13 @@ export type SidebarItem = {
## aside
- Type: `boolean`
- Type: `boolean | 'left'`
- Default: `true`
- Can be overridden per page via [frontmatter](./frontmatter-config#aside)
Setting this value to `false` prevents rendering of aside container.
Setting this value to `false` prevents rendering of aside container.\
Setting this value to `true` renders the aside to the right.\
Setting this value to `left` renders the aside to the left.
## outline

@ -55,6 +55,6 @@ This can be disabled per-page using the `editLink` option on frontmatter:
```yaml
---
lastUpdated: false
editLink: false
---
```

@ -113,10 +113,14 @@ Defines items to display in features section when `layout` is set to `home`. Mor
### aside <Badge type="info" text="default theme only" />
- Type: `boolean`
- Type: `boolean | 'left'`
- Default: `true`
If you want the right aside component in `doc` layout not to be shown, set this option to `false`.
Defines the location of the aside component in the `doc` layout.
Setting this value to `false` prevents rendering of aside container.\
Setting this value to `true` renders the aside to the right.\
Setting this value to `'left'` renders the aside to the left.
```yaml
---

@ -3,7 +3,7 @@
"version": "1.0.0-alpha.63",
"description": "Vite & Vue powered static site generator",
"type": "module",
"packageManager": "pnpm@7.30.3",
"packageManager": "pnpm@8.0.0",
"main": "dist/node/index.js",
"types": "types/index.d.ts",
"exports": {
@ -117,7 +117,7 @@
"@types/debug": "^4.1.7",
"@types/escape-html": "^1.0.2",
"@types/fs-extra": "^11.0.1",
"@types/koa": "^2.13.5",
"@types/koa": "^2.13.6",
"@types/koa-static": "^4.0.2",
"@types/markdown-it": "^12.2.3",
"@types/markdown-it-attrs": "^4.1.0",
@ -125,7 +125,7 @@
"@types/markdown-it-emoji": "^2.0.2",
"@types/micromatch": "^4.0.2",
"@types/minimist": "^1.2.2",
"@types/node": "^18.15.9",
"@types/node": "^18.15.11",
"@types/prompts": "^2.4.3",
"chokidar": "^3.5.3",
"compression": "^1.7.4",
@ -133,7 +133,7 @@
"cross-spawn": "^7.0.3",
"debug": "^4.3.4",
"enquirer": "^2.3.6",
"esbuild": "^0.17.13",
"esbuild": "^0.17.14",
"escape-html": "^1.0.3",
"execa": "^7.1.1",
"fast-glob": "^3.2.12",
@ -150,7 +150,7 @@
"markdown-it-emoji": "^2.0.2",
"micromatch": "^4.0.5",
"minimist": "^1.2.8",
"nanoid": "^4.0.1",
"nanoid": "^4.0.2",
"npm-run-all": "^4.1.5",
"ora": "^6.3.0",
"path-to-regexp": "^6.2.1",
@ -171,7 +171,7 @@
"sirv": "^2.0.2",
"supports-color": "^9.3.1",
"typescript": "^5.0.2",
"vitest": "^0.29.7",
"vitest": "^0.29.8",
"vue-tsc": "^1.3.2",
"wait-on": "^7.0.1"
},

File diff suppressed because it is too large Load Diff

@ -54,6 +54,9 @@ provide('hero-image-slot-exists', heroImageSlotExists)
</VPSidebar>
<VPContent>
<template #page-top><slot name="page-top" /></template>
<template #page-bottom><slot name="page-bottom" /></template>
<template #not-found><slot name="not-found" /></template>
<template #home-hero-before><slot name="home-hero-before" /></template>
<template #home-hero-info><slot name="home-hero-info" /></template>
@ -65,6 +68,8 @@ provide('hero-image-slot-exists', heroImageSlotExists)
<template #doc-footer-before><slot name="doc-footer-before" /></template>
<template #doc-before><slot name="doc-before" /></template>
<template #doc-after><slot name="doc-after" /></template>
<template #doc-top><slot name="doc-top" /></template>
<template #doc-bottom><slot name="doc-bottom" /></template>
<template #aside-top><slot name="aside-top" /></template>
<template #aside-bottom><slot name="aside-bottom" /></template>

@ -21,7 +21,10 @@ const { hasSidebar } = useSidebar()
>
<slot name="not-found" v-if="page.isNotFound"><NotFound /></slot>
<VPPage v-else-if="frontmatter.layout === 'page'" />
<VPPage v-else-if="frontmatter.layout === 'page'">
<template #page-top><slot name="page-top" /></template>
<template #page-bottom><slot name="page-bottom" /></template>
</VPPage>
<VPHome v-else-if="frontmatter.layout === 'home'">
<template #home-hero-before><slot name="home-hero-before" /></template>
@ -33,6 +36,9 @@ const { hasSidebar } = useSidebar()
</VPHome>
<VPDoc v-else>
<template #doc-top><slot name="doc-top" /></template>
<template #doc-bottom><slot name="doc-bottom" /></template>
<template #doc-footer-before><slot name="doc-footer-before" /></template>
<template #doc-before><slot name="doc-before" /></template>
<template #doc-after><slot name="doc-after" /></template>

@ -7,7 +7,7 @@ import VPDocFooter from './VPDocFooter.vue'
import VPDocOutlineDropdown from './VPDocOutlineDropdown.vue'
const route = useRoute()
const { hasSidebar, hasAside } = useSidebar()
const { hasSidebar, hasAside, leftAside } = useSidebar()
const pageName = computed(() =>
route.path.replace(/[./]+/g, '_').replace(/_html$/, '')
@ -19,8 +19,9 @@ const pageName = computed(() =>
class="VPDoc"
:class="{ 'has-sidebar': hasSidebar, 'has-aside': hasAside }"
>
<slot name="doc-top" />
<div class="container">
<div v-if="hasAside" class="aside">
<div v-if="hasAside" class="aside" :class="{'left-aside': leftAside}">
<div class="aside-curtain" />
<div class="aside-container">
<div class="aside-content">
@ -50,6 +51,7 @@ const pageName = computed(() =>
</div>
</div>
</div>
<slot name="doc-bottom" />
</div>
</template>
@ -127,10 +129,16 @@ const pageName = computed(() =>
max-width: 256px;
}
.left-aside {
order: 1;
padding-left: unset;
padding-right: 32px;
}
.aside-container {
position: fixed;
top: 0;
padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + 32px);
padding-top: calc(var(--vp-nav-height) + var(--vp-layout-top-height, 0px) + var(--vp-doc-top-height, 0px) + 32px);
width: 224px;
height: 100vh;
overflow-x: hidden;

@ -121,7 +121,7 @@ onContentUpdated(() => {
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
max-height: calc(var(--vp-vh, 100vh) - 86px);
overflow: scroll;
overflow: hidden auto;
box-shadow: var(--vp-shadow-3);
}

@ -1,5 +1,7 @@
<template>
<div class="VPPage">
<slot name="page-top" />
<Content />
<slot name="page-bottom" />
</div>
</template>

@ -49,6 +49,14 @@ export function useSidebar() {
)
})
const leftAside = computed(() => {
if (hasAside)
return frontmatter.value.aside == null
? theme.value.aside === 'left'
: frontmatter.value.aside === 'left'
return false
})
const hasAside = computed(() => {
if (frontmatter.value.layout === 'home') return false
if (frontmatter.value.aside != null) return !!frontmatter.value.aside
@ -80,6 +88,7 @@ export function useSidebar() {
sidebarGroups,
hasSidebar,
hasAside,
leftAside,
isSidebarEnabled,
open,
close,

@ -13,6 +13,10 @@
background-color: var(--vp-custom-block-info-bg);
}
.custom-block.info th {
color: var(--vp-custom-block-info-text);
}
.custom-block.info code {
background-color: var(--vp-custom-block-info-code-bg);
}
@ -23,6 +27,10 @@
background-color: var(--vp-custom-block-tip-bg);
}
.custom-block.tip th {
color: var(--vp-custom-block-tip-text);
}
.custom-block.tip code {
background-color: var(--vp-custom-block-tip-code-bg);
}
@ -33,6 +41,10 @@
background-color: var(--vp-custom-block-warning-bg);
}
.custom-block.warning th {
color: var(--vp-custom-block-warning-text);
}
.custom-block.warning code {
background-color: var(--vp-custom-block-warning-code-bg);
}
@ -43,6 +55,10 @@
background-color: var(--vp-custom-block-danger-bg);
}
.custom-block.danger th {
color: var(--vp-custom-block-danger-text);
}
.custom-block.danger code {
background-color: var(--vp-custom-block-danger-code-bg);
}
@ -53,6 +69,10 @@
background-color: var(--vp-custom-block-details-bg);
}
.custom-block.details th {
color: var(--vp-custom-block-details-text);
}
.custom-block.details code {
background-color: var(--vp-custom-block-details-code-bg);
}

@ -88,37 +88,6 @@
.DocSearch {
--docsearch-primary-color: var(--vp-c-brand) !important;
}
/**
* VitePress: Custom fix
* -------------------------------------------------------------------------- */
/*
Use lighter colors for links in dark mode for a11y.
Also specify some classes twice to have higher specificity
over scoped class data attribute.
*/
.dark .vp-doc a,
.dark .vp-doc a > code,
.dark .VPNavBarMenuLink.VPNavBarMenuLink:hover,
.dark .VPNavBarMenuLink.VPNavBarMenuLink.active,
.dark .link.link:hover,
.dark .link.link.active,
.dark .edit-link-button.edit-link-button,
.dark .pager-link .title {
color: var(--vp-c-brand-lighter);
}
.dark .vp-doc a:hover,
.dark .vp-doc a > code:hover {
color: var(--vp-c-brand-lightest);
opacity: 1;
}
/* Transition by color instead of opacity */
.dark .vp-doc .custom-block a {
transition: color 0.25s;
}
<% } else { %>
html {
font-family: Arial, Helvetica;

@ -42,10 +42,12 @@ export namespace DefaultTheme {
/**
* Set to `false` to prevent rendering of aside container.
* Set to `true` to render the aside to the right.
* Set to `left` to render the aside to the left.
*
* @default true
*/
aside?: boolean
aside?: boolean | 'left'
/**
* Info for the edit link. If it's undefined, the edit link feature will

Loading…
Cancel
Save