style: organize code styles

pull/129/head
Kia King Ishii 5 years ago
parent 6aa13ce9e8
commit a0261f758d

@ -1,13 +1,13 @@
// exports in this file are exposed to themes and md files via 'vitepress' // exports in this file are exposed to themes and md files via 'vitepress'
// so the user can do `import { useRoute, useSiteData } from 'vitepress'` // so the user can do `import { useRoute, useSiteData } from 'vitepress'`.
// theme types // theme types
export * from './theme' export * from './theme'
// composables // composables
export { useRouter, useRoute, Router, Route } from './router'
export { useSiteData } from './composables/siteData' export { useSiteData } from './composables/siteData'
export { useSiteDataByRoute } from './composables/siteDataByRoute' export { useSiteDataByRoute } from './composables/siteDataByRoute'
export { useRouter, useRoute, Router, Route } from './router'
// components // components
export { Content } from './components/Content' export { Content } from './components/Content'

@ -1,12 +1,12 @@
import { createApp as createClientApp, createSSRApp } from 'vue' import { createApp as createClientApp, createSSRApp } from 'vue'
import { inBrowser, pathToFile } from './utils'
import { createRouter, RouterSymbol } from './router' import { createRouter, RouterSymbol } from './router'
import { siteDataRef } from './composables/siteData'
import { useSiteDataByRoute } from './composables/siteDataByRoute'
import { useUpdateHead } from './composables/head' import { useUpdateHead } from './composables/head'
import { Content } from './components/Content' import { Content } from './components/Content'
import Debug from './components/Debug.vue' import Debug from './components/Debug.vue'
import Theme from '/@theme/index' import Theme from '/@theme/index'
import { inBrowser, pathToFile } from './utils'
import { useSiteDataByRoute } from './composables/siteDataByRoute'
import { siteDataRef } from './composables/siteData'
const NotFound = Theme.NotFound || (() => '404 Not Found') const NotFound = Theme.NotFound || (() => '404 Not Found')
@ -23,7 +23,7 @@ export function createApp() {
// use lean build if this is the initial page load or navigating back // use lean build if this is the initial page load or navigating back
// to the initial loaded path (the static vnodes already adopted the // to the initial loaded path (the static vnodes already adopted the
// static content on that load so no need to re-fetch the page) // static content on that load so no need to re-fetch the page).
if (isInitialPageLoad || initialPath === pageFilePath) { if (isInitialPageLoad || initialPath === pageFilePath) {
pageFilePath = pageFilePath.replace(/\.js$/, '.lean.js') pageFilePath = pageFilePath.replace(/\.js$/, '.lean.js')
} }

@ -8,41 +8,46 @@ export namespace DefaultTheme {
/** /**
* GitHub repository following the format <user>/<project>. * GitHub repository following the format <user>/<project>.
* *
* @example vuejs/vue-next * @example `"vuejs/vue-next"`
*/ */
repo?: string repo?: string
/** /**
* Customize the header label. Defaults to GitHub/Gitlab/Bitbucket depending * Customize the header label. Defaults to GitHub/Gitlab/Bitbucket
* on the provided repo * depending on the provided repo.
* *
* @exampe `"Contribute!"` * @exampe `"Contribute!"`
*/ */
repoLabel?: string repoLabel?: string
/** /**
* If your docs are in a different repository from your main project * If your docs are in a different repository from your main project.
* *
* @example `"vuejs/docs-next"` * @example `"vuejs/docs-next"`
*/ */
docsRepo?: string docsRepo?: string
/** /**
* If your docs are not at the root of the repo. * If your docs are not at the root of the repo.
* *
* @example `"docs"` * @example `"docs"`
*/ */
docsDir?: string docsDir?: string
/** /**
* If your docs are in a different branch. Defaults to `master` * If your docs are in a different branch. Defaults to `master`.
*
* @example `"next"` * @example `"next"`
*/ */
docsBranch?: string docsBranch?: string
/** /**
* Enable links to edit pages at the bottom of the page * Enable links to edit pages at the bottom of the page.
*/ */
editLinks?: boolean editLinks?: boolean
/** /**
* Custom text for edit link. Defaults to "Edit this page" * Custom text for edit link. Defaults to "Edit this page".
*/ */
editLinkText?: string editLinkText?: string
@ -88,10 +93,12 @@ export namespace DefaultTheme {
export interface SideBarGroup { export interface SideBarGroup {
text: string text: string
link?: string link?: string
/** /**
* @default false * @default false
*/ */
collapsable?: boolean collapsable?: boolean
children: SideBarItem[] children: SideBarItem[]
} }
@ -102,10 +109,12 @@ export namespace DefaultTheme {
* @default 5 * @default 5
*/ */
maxSuggestions?: number maxSuggestions?: number
/** /**
* @default '' * @default ''
*/ */
placeholder?: string placeholder?: string
algolia?: { algolia?: {
apiKey: string apiKey: string
indexName: string indexName: string

@ -3,7 +3,7 @@ import './styles/layout.css'
import './styles/code.css' import './styles/code.css'
import './styles/custom-blocks.css' import './styles/custom-blocks.css'
import { Theme } from '/@app/theme' import { Theme } from 'vitepress'
import Layout from './Layout.vue' import Layout from './Layout.vue'
import NotFound from './NotFound.vue' import NotFound from './NotFound.vue'

Loading…
Cancel
Save