110 lines
2.1 KiB
TypeScript
110 lines
2.1 KiB
TypeScript
import { defineConfig, HeadConfig } from "vitepress";
|
|
|
|
export const META_IMAGE = "/social.png";
|
|
|
|
const rControl = /[\u0000-\u001f]/g;
|
|
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g;
|
|
const rCombining = /[\u0300-\u036F]/g;
|
|
|
|
/**
|
|
* Default slugification function
|
|
*/
|
|
export const slugify = (str: string): string =>
|
|
str
|
|
.normalize("NFKD")
|
|
// Remove accents
|
|
.replace(rCombining, "")
|
|
// Remove control characters
|
|
.replace(rControl, "")
|
|
// Replace special characters
|
|
.replace(rSpecial, "-")
|
|
// ensure it doesn't start with a number
|
|
.replace(/^(\d)/, "_$1");
|
|
|
|
export const sharedConfig = defineConfig({
|
|
title: "小蚂蚁云",
|
|
appearance: "light",
|
|
|
|
markdown: {
|
|
theme: {
|
|
dark: "dracula-soft",
|
|
light: "vitesse-light",
|
|
},
|
|
|
|
attrs: {
|
|
leftDelimiter: "%{",
|
|
rightDelimiter: "}%",
|
|
},
|
|
|
|
anchor: {
|
|
slugify,
|
|
},
|
|
},
|
|
|
|
head: [
|
|
["link", { rel: "icon", type: "image/svg+xml", href: "/logo.svg" }],
|
|
["link", { rel: "icon", type: "image/png", href: "/logo.png" }],
|
|
|
|
[
|
|
"meta",
|
|
{
|
|
property: "og:type",
|
|
content: "website",
|
|
},
|
|
],
|
|
|
|
[
|
|
"meta",
|
|
{
|
|
property: "twitter:card",
|
|
content: "summary_large_image",
|
|
},
|
|
],
|
|
[
|
|
"meta",
|
|
{
|
|
property: "twitter:image",
|
|
content: META_IMAGE,
|
|
},
|
|
],
|
|
|
|
// Top banner
|
|
[
|
|
"script",
|
|
{
|
|
src: "/banner.js",
|
|
// @ts-expect-error: vitepress bug
|
|
async: true,
|
|
type: "text/javascript",
|
|
},
|
|
],
|
|
],
|
|
|
|
themeConfig: {
|
|
logo: "/logo.svg",
|
|
outline: [2, 3],
|
|
|
|
socialLinks: [
|
|
{
|
|
icon: "github",
|
|
link: "https://gitee.com/djangoadmin/DjangoAdmin_Django_EleVue",
|
|
},
|
|
],
|
|
|
|
footer: {
|
|
copyright:
|
|
"Copyright © 2021~2026 www.djangoadmin.cn. All rights reserved.",
|
|
message: "小蚂蚁云团队 · 提供技术支持",
|
|
},
|
|
|
|
editLink: {
|
|
pattern: "https://gitee.com/djangoadmin/DjangoAdmin_Django_EleVue",
|
|
text: "对本页提出修改建议",
|
|
},
|
|
|
|
search: {
|
|
provider: "local",
|
|
},
|
|
},
|
|
});
|