安装
首先参考 手动安装 安装本体
然后 npm i -D vuepress-plugin-md-enhance
安装 md-enhance
,下面会参考 Markdown 增强
配置
import { defineUserConfig } from 'vuepress'
import { defaultTheme } from 'vuepress'
import { mdEnhancePlugin } from "vuepress-plugin-md-enhance"
export default defineUserConfig({
lang: 'zh-CN',
title: '标题',
head: [['link', { rel: 'icon', href: '/favicon.svg' }]], // tab 图标
theme: defaultTheme({
logo: '/favicon.svg', // 主图标
sidebar: [
'文件名(可不带.md)',
]
}),
plugins: [
mdEnhancePlugin({
footnote: true, // 支持脚注
// container: true, // 支持容器,后来发现默认样式也不错
align: true,
}),
],
})
// 用以修改颜色
:root {
--c-brand: #B390D9;
--c-brand-light: #C4A8E1;
}
html.dark {
--c-brand: #A594F9;
--c-brand-light: #CDC1FF;
}
<!--用以修改默认 404 -->
<!--可以添加任何合法的 Vue 元素 -->
PWA
非根路径
location ~ ^/yourpath/(?<remainpath>.*)$ {
# basic auth
auth_basic "input username and password!"; # 最好独特一点
auth_basic_user_file /etc/nginx/auth.db;
absolute_redirect off; # 防止 redirect 时到 http 协议上,防止中间人攻击
alias /your/path/on/server/;
error_page 404 404.html;
# static files
if ( $remainpath ~* ^.+\.(css|js)$ ) {
expires max;
access_log off;
}
if ( $remainpath ~* ^.+\.(ico|gif|jpg|jpeg|png|svg)$ ) {
expires 30d;
access_log off;
}
}
export default defineUserConfig({
...
base: '/youtpath/',
...
})
#!/bin/bash
dbfile="/etc/nginx/auth.db" # 根据上面更改
if [ $# -lt 1 ];then
echo "Usage:"
echo "$0 edit edit the password database file"
echo "$0 [username] (-p) generate password with the username (with prompt input)"
exit 0;
fi
if [ $1 == edit ];then
sudo vim $dbfile
sudo nginx -s reload
exit 0;
fi
if [ "$2" == "-p" ];then
read -s -p "请输入密码: " genpassword
echo
else
genpassword=$(openssl rand -base64 6)
fi
echo $1:$(openssl passwd -5 -salt $(openssl rand -base64 12) $genpassword) | sudo tee -a $dbfile >> /dev/null
sudo nginx -s reload
echo -e "用户名\t$1"
echo -e "密码\t$genpassword"