$ErrorActionPreference = 'Stop' $repoRoot = Split-Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Parent $base = Join-Path $repoRoot '基于考研的学习/数学一/在学练习' $tool = Join-Path $PSScriptRoot 'md2pdf.js' foreach ($lesson in @(@(2,'矩阵'),@(3,'向量'),@(4,'线性方程组'))) { $n = $lesson[0] $topic = $lesson[1] $folder = Join-Path $base "线性代数-第$n`讲-$topic" foreach ($item in @(@('01-考点手册.md','考点手册','plain'),@('02-试题.md','试题-答题版','answer'),@('03-解析.md','解析','plain'))) { $source = Join-Path $folder $item[0] $output = Join-Path $folder "PDF/线代第$n`讲-$($item[1]).pdf" & node $tool --in $source --out $output --title "线性代数 第$n`讲 · $topic · $($item[1])" --mode $item[2] if ($LASTEXITCODE -ne 0) { throw "PDF 构建失败:$source" } } }