Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly type vitepress/theme #494

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"bin",
"dist",
"types",
"client.d.ts"
"client.d.ts",
"theme.d.ts"
],
"scripts": {
"dev": "run-s dev-shared dev-start",
Expand Down
4 changes: 3 additions & 1 deletion src/node/markdown/plugins/containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ function createContainer(klass: string, defaultTitle: string): ContainerArgs {
const info = token.info.trim().slice(klass.length).trim()
if (token.nesting === 1) {
if (klass === 'details') {
return `<details class="${klass} custom-block">${info ? `<summary>${info}</summary>` : ''}\n`
return `<details class="${klass} custom-block">${
info ? `<summary>${info}</summary>` : ''
}\n`
}
return `<div class="${klass} custom-block"><p class="custom-block-title">${
info || defaultTitle
Expand Down
2 changes: 1 addition & 1 deletion src/node/serve/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface ServeOptions {
export async function serve(options: ServeOptions = {}) {
const port = options.port !== undefined ? options.port : 5000
const site = await resolveConfig(options.root, 'serve', 'production')
const base = trimChar(site?.site?.base ?? "", "/")
const base = trimChar(site?.site?.base ?? '', '/')

const compress = compression()
const serve = sirv(site.outDir, {
Expand Down
2 changes: 1 addition & 1 deletion src/shared/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type {
HeadConfig,
LocaleConfig,
Header,
DefaultTheme,
DefaultTheme
} from '../../types/shared'

export const EXTERNAL_URL_RE = /^https?:/i
Expand Down
5 changes: 3 additions & 2 deletions theme.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// so that users can do `import DefaultTheme from 'vitepress/theme'`
import DefaultTheme from './dist/client/theme-default/index'
export default DefaultTheme
import { Theme } from 'vitepress'
declare const theme: Theme
export default theme