mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
Merge pull request #19 from huankong233/main
This commit is contained in:
commit
2dfe9e4170
@ -22,6 +22,7 @@ html {
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
scroll-behavior: smooth;
|
scroll-behavior: smooth;
|
||||||
|
scroll-padding-top: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|||||||
@ -10,7 +10,10 @@ import type {
|
|||||||
import type { NotesItem } from '@vuepress-plume/vuepress-plugin-notes-data'
|
import type { NotesItem } from '@vuepress-plume/vuepress-plugin-notes-data'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { customAlphabet } from 'nanoid'
|
import { customAlphabet } from 'nanoid'
|
||||||
import type { PlumeThemeLocaleOptions } from '../shared/index.js'
|
import type {
|
||||||
|
PlumeThemePluginOptions,
|
||||||
|
PlumeThemeLocaleOptions
|
||||||
|
} from '../shared/index.js'
|
||||||
|
|
||||||
const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 8)
|
const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 8)
|
||||||
const require = createRequire(process.cwd())
|
const require = createRequire(process.cwd())
|
||||||
@ -28,6 +31,7 @@ const normalizePath = (dir: string) => {
|
|||||||
|
|
||||||
export default function autoFrontmatter(
|
export default function autoFrontmatter(
|
||||||
app: App,
|
app: App,
|
||||||
|
options: PlumeThemePluginOptions,
|
||||||
localeOption: PlumeThemeLocaleOptions
|
localeOption: PlumeThemeLocaleOptions
|
||||||
): AutoFrontmatterOptions {
|
): AutoFrontmatterOptions {
|
||||||
const sourceDir = app.dir.source()
|
const sourceDir = app.dir.source()
|
||||||
@ -86,8 +90,9 @@ export default function autoFrontmatter(
|
|||||||
return dirList.length > 0 ? dirList[dirList.length - 1] : ''
|
return dirList.length > 0 ? dirList[dirList.length - 1] : ''
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
include: ['**/*.md'],
|
include: options.frontmatter.include ?? ['**/*.{md,MD}'],
|
||||||
frontmatter: [
|
exclude: options.frontmatter.exclude ?? ['.vuepress/**/*', 'node_modules'],
|
||||||
|
frontmatter: options.frontmatter.frontmatter ?? [
|
||||||
localesNotesDirs.length
|
localesNotesDirs.length
|
||||||
? {
|
? {
|
||||||
// note 首页链接
|
// note 首页链接
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export const setupPlugins = (
|
|||||||
: undefined,
|
: undefined,
|
||||||
} as any,
|
} as any,
|
||||||
}),
|
}),
|
||||||
autoFrontmatterPlugin(autoFrontmatter(app, localeOptions)),
|
autoFrontmatterPlugin(autoFrontmatter(app, options, localeOptions)),
|
||||||
blogDataPlugin({
|
blogDataPlugin({
|
||||||
include: localeOptions.blog?.include,
|
include: localeOptions.blog?.include,
|
||||||
exclude: [
|
exclude: [
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import type { CanIUsePluginOptions } from '@vuepress-plume/vuepress-plugin-caniu
|
|||||||
import type { CopyCodeOptions } from '@vuepress-plume/vuepress-plugin-copy-code'
|
import type { CopyCodeOptions } from '@vuepress-plume/vuepress-plugin-copy-code'
|
||||||
import type { CommentPluginOptions } from 'vuepress-plugin-comment2'
|
import type { CommentPluginOptions } from 'vuepress-plugin-comment2'
|
||||||
import type { MarkdownEnhanceOptions } from 'vuepress-plugin-md-enhance'
|
import type { MarkdownEnhanceOptions } from 'vuepress-plugin-md-enhance'
|
||||||
|
import type { AutoFrontmatterOptions } from '@vuepress-plume/vuepress-plugin-auto-frontmatter'
|
||||||
|
|
||||||
export interface PlumeThemePluginOptions {
|
export interface PlumeThemePluginOptions {
|
||||||
/**
|
/**
|
||||||
@ -49,4 +50,6 @@ export interface PlumeThemePluginOptions {
|
|||||||
seo?: false
|
seo?: false
|
||||||
|
|
||||||
baiduTongji?: false | BaiduTongjiOptions
|
baiduTongji?: false | BaiduTongjiOptions
|
||||||
|
|
||||||
|
frontmatter?: AutoFrontmatterOptions
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user