Starlight 文档
常用命令速查
每次更新网站内容后的标准流程:
git pull --rebase origin maingit add .git commit -m "描述改动内容"git push origin main本地预览:
pnpm dev网站内容管理
Section titled “网站内容管理”新增工具文章
Section titled “新增工具文章”-
新建
src/content/docs/tools/文件名.md,写入 frontmatter:---title: "文章标题"description: "一句话描述"--- -
在
astro.config.mjs的 sidebar 对应分组里加一行:{ label: "显示名称", slug: "tools/文件名" }
新增书签条目
Section titled “新增书签条目”编辑 src/data/bookmarks.ts,在对应分类的 items 里加:
{ name: '工具名', url: 'https://...', desc: '一句话描述', opensource: true }新增书签分类
Section titled “新增书签分类”-
bookmarks.ts新增对象:{ category: '新分类', icon: '🔧', items: [...] } -
bookmarks.mdx加两行:## 新分类<BookmarkGrid category="新分类" /> -
BookmarkGrid.astro的iconMap加对应图标映射。
新增左侧目录分组
Section titled “新增左侧目录分组”在 astro.config.mjs 的 sidebar 加:
{ label: "分组名称", items: [ { label: "页面名", slug: "路径/文件名" }, ],},新电脑克隆仓库
Section titled “新电脑克隆仓库”-
生成 SSH 密钥并添加到 GitHub:
Terminal window ssh-keygen -t ed25519 -C "your_email@example.com"cat ~/.ssh/id_ed25519.pub复制公钥 → GitHub → Settings → SSH and GPG keys → New SSH key。
-
克隆仓库:
Terminal window git clone git@github.com:0xshai/bookmarks.gitcd bookmarkspnpm dev -
如果 pnpm 版本切换报错:
Terminal window pnpm config set pmOnFail ignore再重新运行
pnpm dev。
查看与切换远程地址
Section titled “查看与切换远程地址”# 查看当前用的哪种git remote -v
# 切换为 SSH(推荐)git remote set-url origin git@github.com:0xshai/仓库名.git
# 切换为 HTTPSgit remote set-url origin https://github.com/0xshai/仓库名.gitgit status # 查看状态git log --oneline -10 # 查看提交历史git pull origin main # 拉取最新代码git reset --soft HEAD~1 # 撤销最后一次提交(保留改动)git reset --hard HEAD # 丢弃所有本地改动git diff 文件路径 # 查看某文件改动HTTPS 方式(用 Token)
Section titled “HTTPS 方式(用 Token)”git clone https://github.com/0xshai/仓库名.git提交信息规范
Section titled “提交信息规范”feat: 新功能fix: 修复问题docs: 文档改动style: 样式调整refactor: 重构chore: 杂项(依赖更新等)示例:git commit -m "feat: 新增工具说明分类"
PowerShell
Section titled “PowerShell”代理 / 网络切换
Section titled “代理 / 网络切换”# 设置代理(当前会话有效)$env:HTTP_PROXY = "http://127.0.0.1:7890"$env:HTTPS_PROXY = "http://127.0.0.1:7890"
# 取消代理(切回直连)Remove-Item Env:HTTP_PROXY -ErrorAction SilentlyContinueRemove-Item Env:HTTPS_PROXY -ErrorAction SilentlyContinue
# Git 单独设置代理git config --global http.proxy http://127.0.0.1:7890
# 取消 Git 代理git config --global --unset http.proxygit config --global --unset https.proxy右键管理员运行以下脚本,或提前保存为 fix-network.bat 放到桌面备用:
@echo offecho 正在修复网络...
echo [1/5] 释放 IP 地址...ipconfig /release
echo [2/5] 清除 DNS 缓存...ipconfig /flushdns
echo [3/5] 重新获取 IP 地址...ipconfig /renew
echo [4/5] 重置 Winsock...netsh winsock reset
echo [5/5] 重置 TCP/IP 协议栈...netsh int ip reset
echo.echo 修复完成,请重启电脑。pause修复前后可用以下命令测试网络连通性:
ping 8.8.8.8 # 测试网络是否通(不依赖 DNS)ping github.com # 测试 DNS 解析是否正常Get-Content 文件路径 # 查看文件内容Get-Content 文件路径 | Select-Object -Index (9..19) # 查看指定行(第10-20行)Select-String -Path 文件路径 -Pattern "关键词" # 搜索文件内容Remove-Item -Recurse -Force 文件夹路径 # 删除文件夹New-Item -ItemType Directory -Path 文件夹路径 # 新建文件夹Copy-Item 源路径 目标路径 # 复制文件netstat -ano | findstr :4321 # 查看端口占用验证文件 Hash
Section titled “验证文件 Hash”(Get-FileHash "文件路径" -Algorithm SHA256).Hash -eq "官方SHA256值"scoop install 软件名 # 安装scoop uninstall 软件名 # 卸载scoop update 软件名 # 更新单个scoop update * # 更新所有scoop update # 更新 Scoop 本身scoop list # 查看已安装列表scoop search 关键词 # 搜索scoop cleanup * # 清理旧版本scoop info 软件名 # 查看软件信息scoop bucket add extras # 添加 bucketscoop bucket add versionsImageMagick 批量转 AVIF
Section titled “ImageMagick 批量转 AVIF”magick mogrify -format avif -quality 80 *.jpgFFmpeg
Section titled “FFmpeg”ffmpeg -i 文件名 # 查看文件信息ffmpeg -i 输入.mp4 输出.mkv # 转换格式ffmpeg -i 输入.mp4 -ss 00:01:00 -to 00:02:00 -c copy 输出.mp4 # 无损剪切ffmpeg -i 输入.mp4 -vn -acodec copy 输出.aac # 提取音频HandBrake CLI(AV1 编码)
Section titled “HandBrake CLI(AV1 编码)”HandBrakeCLI -i 输入.mp4 -o 输出.mp4 --encoder svt_av1 --quality 30 --encoder-preset 6Windows 快捷键
Section titled “Windows 快捷键”| 快捷键 | 功能 |
|---|---|
Win + Shift + S | 区域截图(截后点通知可标注) |
PrtScn | 全屏截图到剪贴板 |
Win + PrtScn | 全屏截图自动保存到图片文件夹 |
Win + G | 打开 Xbox Game Bar |
Win + Alt + R | 开始/停止录制当前窗口 |
| 快捷键 | 功能 |
|---|---|
Win + ←/→ | 窗口贴左/右半屏 |
Win + ↑ | 窗口最大化 |
Win + ↓ | 还原/最小化窗口 |
Win + D | 显示桌面 |
Win + Tab | 任务视图(所有虚拟桌面) |
Alt + Tab | 切换窗口 |
Win + Ctrl + ←/→ | 切换虚拟桌面 |
文件资源管理器
Section titled “文件资源管理器”| 快捷键 | 功能 |
|---|---|
Win + E | 打开文件资源管理器 |
Alt + ←/→ | 后退/前进 |
Alt + ↑ | 返回上级目录 |
F2 | 重命名 |
Ctrl + Shift + N | 新建文件夹 |
| 快捷键 | 功能 |
|---|---|
Win + L | 锁屏 |
Win + I | 打开设置 |
Win + V | 剪贴板历史 |
Win + . | 表情符号面板 |
Ctrl + Shift + Esc | 直接打开任务管理器 |