feat(在学练习): 概率论第5讲(大数定律与CLT)+第6讲(数理统计) 整套;第3讲中高难度卷;md2pdf 工具链
新增 - 在学练习/概率论-第5讲-大数定律与中心极限定理/:README + 01考点手册 + 02试题(16题) + 03解析 + PDF×3 - 在学练习/概率论-第6讲-数理统计/:README + 01考点手册 + 02试题(18题) + 03解析 + PDF×3 - 在学练习/概率论-第3讲.../05-试题-中高难度.md、06-解析-中高难度.md + 平板版 PDF×6(四件套 + 中高难度) - .workbuddy/tools/md2pdf/:md2pdf.js(Markdown→KaTeX→Edge 无头打印 A4,含 answer 留白模式)、shot.js(渲染验收截图) - .workbuddy/memory/:2026-10-14.md、2026-10-16.md、MEMORY.md 更新 - .gitignore:新增忽略 md2pdf/build/(HTML 内联字体,体积大) - 总览.md:目录树同步(第5/6讲、第3讲中高难度卷、PDF 清单) - 第3讲 01-考点手册/02-试题/README:中高难度卷接入与索引回填 说明:PDF 为 KaTeX 矢量公式渲染的平板书写版(试题逐题留白),由 md2pdf.js 从 .md 可重建。
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const NM = 'C:/Users/Wang Ling/.workbuddy/binaries/node/workspace/node_modules';
|
||||
const puppeteer = require(path.join(NM, 'puppeteer-core'));
|
||||
const EDGE = 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe';
|
||||
|
||||
(async () => {
|
||||
const html = process.argv[2];
|
||||
const outPng = process.argv[3];
|
||||
const startPx = parseInt(process.argv[4] || '0', 10);
|
||||
const heightPx = parseInt(process.argv[5] || '1123', 10);
|
||||
const browser = await puppeteer.launch({ executablePath: EDGE, headless: 'new', args: ['--no-sandbox', '--allow-file-access-from-files'] });
|
||||
const page = await browser.newPage();
|
||||
await page.setViewport({ width: 794, height: 1123, deviceScaleFactor: 1.6 });
|
||||
await page.goto('file:///' + path.resolve(html).replace(/\\/g, '/'), { waitUntil: 'load', timeout: 120000 });
|
||||
const total = await page.evaluate(() => document.body.scrollHeight);
|
||||
await page.screenshot({ path: outPng, clip: { x: 0, y: startPx, width: 794, height: Math.min(heightPx, total - startPx) } });
|
||||
console.log('html height px =', total, ' -> screenshot', outPng);
|
||||
await browser.close();
|
||||
})().catch(e => { console.error(e); process.exit(1); });
|
||||
Reference in New Issue
Block a user